Advertisement
Guest User

Body swap potion

a guest
Dec 12th, 2019
2,824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. WORKS ONLY IN R6 SCRIPT VERY OLD!
  2.  
  3.  
  4. function sandbox(var,func)
  5. local env = getfenv(func)
  6. local newenv = setmetatable({},{
  7. __index = function(self,k)
  8. if k=="script" then
  9. return var
  10. else
  11. return env[k]
  12. end
  13. end,
  14. })
  15. setfenv(func,newenv)
  16. return func
  17. end
  18. cors = {}
  19. mas = Instance.new("Model",game:GetService("Lighting"))
  20. Tool0 = Instance.new("Tool")
  21. Part1 = Instance.new("Part")
  22. SpecialMesh2 = Instance.new("SpecialMesh")
  23. LocalScript3 = Instance.new("LocalScript")
  24. LocalScript4 = Instance.new("LocalScript")
  25. Animation5 = Instance.new("Animation")
  26. LocalScript6 = Instance.new("LocalScript")
  27. Tool0.Name = "FreakyFridayPotion"
  28. Tool0.Parent = mas
  29. Tool0.TextureId = "http://www.roblox.com/asset/?id=78673347"
  30. Tool0.GripForward = Vector3.new(-0, 1, -0)
  31. Tool0.GripPos = Vector3.new(0.150000006, -0.150000006, -0.5)
  32. Tool0.GripUp = Vector3.new(-0, 0, 1)
  33. Part1.Name = "Handle"
  34. Part1.Parent = Tool0
  35. Part1.BrickColor = BrickColor.new("Bright bluish green")
  36. Part1.Rotation = Vector3.new(-90, 0, 0)
  37. Part1.Locked = true
  38. Part1.FormFactor = Enum.FormFactor.Custom
  39. Part1.Size = Vector3.new(0.659999907, 0.80000025, 1.62999988)
  40. Part1.CFrame = CFrame.new(-15.3299999, 0.814999938, 4.5999999, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  41. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  42. Part1.Position = Vector3.new(-15.3299999, 0.814999938, 4.5999999)
  43. Part1.Orientation = Vector3.new(-90, 0, 0)
  44. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  45. SpecialMesh2.Parent = Part1
  46. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=78673311"
  47. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=78673334"
  48. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  49. LocalScript3.Name = "Local Gui"
  50. LocalScript3.Parent = Tool0
  51. table.insert(cors,sandbox(LocalScript3,function()
  52. local Tool = script.Parent;
  53.  
  54. local stillEquipped = true
  55. function onEquippedLocal(mouse)
  56. stillEquipped = true
  57. if mouse == nil then
  58. print("Mouse not found")
  59. return
  60. end
  61.  
  62. while stillEquipped do
  63. print("Setting Mouse to Go")
  64. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  65.  
  66. while Tool.Enabled and stillEquipped do
  67. wait(.01)
  68. end
  69.  
  70. print("Setting Mouse To Wait")
  71. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  72.  
  73. while not Tool.Enabled and stillEquipped do
  74. wait(.01)
  75. end
  76. end
  77. end
  78.  
  79. function onUnequippedLocal()
  80. stillEquipped = false
  81. end
  82.  
  83.  
  84. Tool.Equipped:connect(onEquippedLocal)
  85. Tool.Unequipped:connect(onUnequippedLocal)
  86.  
  87. end))
  88. LocalScript4.Name = "FridayScript"
  89. LocalScript4.Parent = Tool0
  90. table.insert(cors,sandbox(LocalScript4,function()
  91. --[[
  92.  
  93. // Don't forget to add helper GUI stuff
  94. ]]
  95.  
  96. local Tool = script.Parent
  97. local Potion = Tool.Handle
  98.  
  99. Tool.Enabled = true
  100.  
  101. local vCharacter
  102. local vTorso
  103. local vHumanoid
  104. local vPlayer
  105.  
  106. local OtherPlayer = nil
  107. local OtherCharacter = nil
  108. local OtherHumanoid
  109. local OtherTorso
  110.  
  111. local SwapSound = nil
  112. local SwapAnim
  113. local OtherSwapAnim
  114.  
  115. local RBX_Debris = game:GetService("Debris")
  116.  
  117. local Mouse = nil
  118.  
  119. game.Players.LocalPlayer.Character.Archivable = true
  120. local Clone = game.Players.LocalPlayer.Character:Clone()
  121. local cChildren = Clone:GetChildren()
  122. for i = 1, #cChildren do
  123. if cChildren[i]:IsA("Script") then
  124. cChildren[i]:Destroy()
  125. end
  126. end
  127. local Clone2 = Clone:Clone()
  128.  
  129. local function spawnClone(character, torso, clone)
  130. if character and torso and clone then
  131. local thisClone = clone:Clone()
  132.  
  133. thisClone.Name = character.Name
  134.  
  135. local target = thisClone:FindFirstChild("Target")
  136. if target then
  137. target.Value = character:FindFirstChild("Humanoid")
  138. else
  139. target = Instance.new("ObjectValue")
  140. target.Name = "Target"
  141. target.Parent = thisClone
  142. target.Value = character:FindFirstChild("Humanoid")
  143. end
  144.  
  145. thisClone:MoveTo(torso.Position + Vector3.new(5, 0, 5))
  146.  
  147. return thisClone
  148. end
  149. end
  150.  
  151. local function dressClone(character, clone)
  152. if character then
  153. local children = character:GetChildren()
  154. for i = 1, #children do
  155. if children[i] then
  156. if children[i].ClassName == "Hat" then
  157. -- Special
  158. local hat = Instance.new("Hat")
  159. local Hpart = children[i].Handle:clone()
  160. Hpart.Parent = hat
  161. Hpart.Position = clone.Head.Position
  162. hat.Name = children[i].Name
  163. hat.Parent = clone
  164. hat.AttachmentPos = children[i].AttachmentPos
  165. hat.AttachmentRight = children[i].AttachmentRight
  166. hat.AttachmentUp = children[i].AttachmentUp
  167. hat.AttachmentForward = children[i].AttachmentForward
  168. elseif children[i]:IsA("BasePart") then
  169. if clone:FindFirstChild(children[i].Name) and clone[children[i].Name]:IsA("BasePart") then
  170. clone[children[i].Name].BrickColor = children[i].BrickColor
  171. end
  172. elseif children[i].ClassName == "ForceField" or children[i]:IsA("Humanoid") then
  173. -- Ignore it
  174. else
  175. children[i]:Clone().Parent = clone
  176. end
  177. end
  178. end
  179. return clone
  180. end
  181. end
  182.  
  183. local function onActivated()
  184. if Tool.Enabled == false then
  185. return
  186. end
  187.  
  188. if not vTorso or not vHumanoid then
  189. return
  190. end
  191.  
  192. local target = Mouse.Target
  193. if target and target.Parent then
  194. print(target)
  195. local humanoid = target.Parent:FindFirstChild("Humanoid")
  196. if target.Parent:IsA("Hat") and target.Parent.Parent then
  197. humanoid = target.Parent.Parent:FindFirstChild("Humanoid")
  198. end
  199. if humanoid then
  200. OtherPlayer = game.Players:GetPlayerFromCharacter(humanoid.Parent)
  201. OtherHumanoid = humanoid
  202. OtherTorso = OtherPlayer.Character:FindFirstChild("Torso")
  203. end
  204.  
  205. if OtherPlayer and OtherHumanoid and OtherTorso then
  206. local cf1 = vTorso.CFrame
  207. local cf2 = OtherTorso.CFrame
  208. print(cf1.p, cf2.p)
  209. OtherCharacter = OtherHumanoid.Parent
  210. SwapAnim = vHumanoid:LoadAnimation(Tool.SwapAnim)
  211. if SwapAnim then SwapAnim:Play() end
  212. OtherSwapAnim = OtherHumanoid:LoadAnimation(Tool.SwapAnim)
  213. if OtherSwapAnim then OtherSwapAnim:Play() end
  214. vHumanoid.WalkSpeed = 0.0
  215. OtherHumanoid.WalkSpeed = 0.0
  216. wait(2.0)
  217. SwapSound = Tool:FindFirstChild("SwapSound")
  218. if SwapSound then SwapSound:Play() end
  219. vHumanoid.WalkSpeed = 16.0
  220. OtherHumanoid.WalkSpeed = 16.0
  221.  
  222. local c = spawnClone(vCharacter, vTorso, Clone)
  223. local c1 = spawnClone(OtherCharacter, OtherTorso, Clone)
  224. c1 = dressClone(vCharacter, c1)
  225. c = dressClone(OtherCharacter, c)
  226. vPlayer.Character = c
  227. OtherPlayer.Character = c1
  228. vPlayer.Character.Parent = game.Workspace
  229. vPlayer.Character.Torso.CFrame = cf2
  230. OtherPlayer.Character.Parent = game.Workspace
  231. OtherPlayer.Character.Torso.CFrame = cf1
  232. end
  233. end
  234. end
  235.  
  236. local function onEquipped(mouse)
  237. vCharacter = Tool.Parent
  238. vTorso = vCharacter:FindFirstChild("Torso")
  239. vHumanoid = vCharacter:FindFirstChild("Humanoid")
  240. vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
  241. Mouse = mouse
  242. end
  243.  
  244. local function onUnequipped()
  245. if SwapSound then SwapSound:Stop() end
  246. if SwapAnim then SwapAnim:Stop() end
  247. if OtherSwapAnim then OtherSwapAnim:Stop() end
  248. if vHumanoid then vHumanoid.WalkSpeed = 16.0 end
  249. if OtherHumanoid then OtherHumanoid.WalkSpeed = 16.0 end
  250. end
  251.  
  252. Tool.Equipped:connect(onEquipped)
  253. Tool.Activated:connect(onActivated)
  254. Tool.Unequipped:connect(onUnequipped)
  255. end))
  256. Animation5.Name = "SwapAnim"
  257. Animation5.Parent = Tool0
  258. Animation5.AnimationId = "http://www.roblox.com/Asset?ID=78674033"
  259. LocalScript6.Name = "GuiScript"
  260. LocalScript6.Parent = Tool0
  261. table.insert(cors,sandbox(LocalScript6,function()
  262. local Tool = script.Parent
  263. local Lantern = Tool.Handle
  264.  
  265. local vCharacter
  266. local vPlayer
  267. local genericTextLabel
  268.  
  269. local sg
  270. local frame
  271.  
  272. function onEquipped()
  273. vCharacter = Tool.Parent
  274. vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
  275. if vPlayer then
  276. local playerGui = vPlayer:FindFirstChild("PlayerGui")
  277. if playerGui and playerGui:FindFirstChild("LanternGui") == nil then
  278. sg = Instance.new("ScreenGui")
  279. sg.Name = "LanternGui"
  280. sg.Parent = playerGui
  281.  
  282. frame = Instance.new("Frame")
  283. frame.Parent = sg
  284. frame.Size = UDim2.new(0, 240, 0, 30)
  285. frame.Position = UDim2.new(0.5, -120, 1, -130)
  286. frame.Style = Enum.FrameStyle.RobloxRound
  287.  
  288. genericTextLabel = Instance.new("TextLabel")
  289. genericTextLabel.BackgroundTransparency = 1.0
  290. genericTextLabel.Size = UDim2.new(1, 0, 1, 0)
  291. genericTextLabel.Visible = true
  292. genericTextLabel.ZIndex = 10
  293. genericTextLabel.FontSize = Enum.FontSize.Size10
  294. genericTextLabel.Font = Enum.Font.Legacy
  295. genericTextLabel.TextColor3 = Color3.new(1, 127/255, 0)
  296. genericTextLabel.TextXAlignment = Enum.TextXAlignment.Center
  297. genericTextLabel.TextYAlignment = Enum.TextYAlignment.Top
  298. genericTextLabel.Parent = frame
  299. genericTextLabel.Text = "Click on someone to swap bodies!!"
  300. end
  301. end
  302. end
  303.  
  304. function onUnequipped()
  305. if sg then sg:Remove() end
  306. end
  307.  
  308. Tool.Equipped:connect(onEquipped)
  309. Tool.Unequipped:connect(onUnequipped)
  310.  
  311.  
  312. end))
  313. for i,v in pairs(mas:GetChildren()) do
  314. v.Parent = script
  315. pcall(function() v:MakeJoints() end)
  316. end
  317. mas:Destroy()
  318. for i,v in pairs(cors) do
  319. spawn(function()
  320. pcall(v)
  321. end)
  322. end
  323. Tool0.Parent = game.Players.LocalPlayer.Backpack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement