Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Script3 = Instance.new("Script")
- LocalScript4 = Instance.new("LocalScript")
- Animation5 = Instance.new("Animation")
- ObjectValue6 = Instance.new("ObjectValue")
- RemoteEvent7 = Instance.new("RemoteEvent")
- LocalScript8 = Instance.new("LocalScript")
- Tool0.Name = "FreakyFridayPotion"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=78673347"
- Tool0.GripForward = Vector3.new(-0, 1, -0)
- Tool0.GripPos = Vector3.new(0.150000006, -0.150000006, -0.5)
- Tool0.GripUp = Vector3.new(0, 0, 1)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Bright bluish green")
- Part1.Rotation = Vector3.new(-90, 0, 0)
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(0.659999907, 0.80000025, 1.62999988)
- Part1.CFrame = CFrame.new(21.4099903, 0.814999938, -15.7599859, 1, 0, 0, 0, 0, 1, 0, -1, 0)
- Part1.Color = Color3.new(0, 0.560784, 0.611765)
- Part1.Position = Vector3.new(21.4099903, 0.814999938, -15.7599859)
- Part1.Orientation = Vector3.new(-90, 0, 0)
- Part1.Color = Color3.new(0, 0.560784, 0.611765)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=78673311"
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=78673334"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Script3.Parent = Tool0
- table.insert(cors,sandbox(Script3,function()
- local Tool = script.Parent
- local Players = game:GetService'Players'
- SwitchClothes = {
- Accoutrement = function(char, hat)
- local handle = hat:FindFirstChild'Handle'
- local head = char:FindFirstChild'Head'
- handle:BreakJoints()
- if handle and handle:IsA'BasePart' and head and head:IsA'BasePart' then
- hat.Parent = nil
- local hatWeld = Instance.new'Weld'
- hatWeld.Part0 = head
- hatWeld.Part1 = handle
- hatWeld.C1 = head.CFrame * hat.AttachmentPoint:inverse() * CFrame.new(0, 0.5, -9.53674316e-007, 1, -1.89326617e-029, 0, -1.89326617e-029, 1, 2.5243549e-029, 0, 2.5243549e-029, 1)
- hatWeld.Name = 'HeadWeld'
- hatWeld.Parent = head
- hat.Parent = char
- end
- end,
- CharacterAppearance = function(char, appItem)
- appItem.Parent = char
- end,
- DataModelMesh = function(char, appItem)
- appItem.Parent = char:FindFirstChild'Head'
- end,
- FaceInstance = function(char, appItem)
- appItem.Parent = char:FindFirstChild'Head'
- end
- }
- function animate(char)
- local animateScript = script.AnimateCharacterScript:Clone()
- for i, obj in next, char:GetChildren() do
- if obj:IsA'Humanoid' or obj:IsA'AnimationController' then
- animateScript.Humanoid.Value = obj
- break
- end
- end
- animateScript.Parent = char
- animateScript.Disabled = false
- end
- Tool.SwapWith.OnServerEvent:connect(function(client, character)
- if client == Players:GetPlayerFromCharacter(Tool.Parent) and client.Character then
- local otherPlayer = Players:GetPlayerFromCharacter(character)
- if not otherPlayer then return end -- Remove to make it work with NPCs
- local clothesA, clothesB = {}, {}
- for i, child in next, client.Character:GetChildren() do
- local use = false
- for className in next, SwitchClothes do
- if child:IsA(className) then
- use = true
- break
- end
- end
- if use then
- table.insert(clothesA, child)
- end
- end
- for i, obj in next, client.Character:FindFirstChild'Head' and client.Character.Head:GetChildren() do
- if obj:IsA'DataModelMesh' or obj:IsA'FaceInstance' then
- table.insert(clothesA, obj)
- end
- end
- for i, child in next, character:GetChildren() do
- local use = false
- for className in next, SwitchClothes do
- if child:IsA(className) then
- use = true
- break
- end
- end
- if use then
- table.insert(clothesB, child)
- end
- end
- for i, obj in next, character:FindFirstChild'Head' and character.Head:GetChildren() do
- if obj:IsA'DataModelMesh' or obj:IsA'FaceInstance' then
- table.insert(clothesB, obj)
- end
- end
- for i, item in next, clothesA do
- for className, f in next, SwitchClothes do
- if item:IsA(className) then print(item:GetFullName(),'is',className)
- f(character, item)
- print(item:GetFullName(),'moved')
- break
- end
- end
- end
- for i, item in next, clothesB do
- for className, f in next, SwitchClothes do
- if item:IsA(className) then
- f(client.Character, item)
- break
- end
- end
- end
- if otherPlayer then
- animate(character)
- end
- animate(client.Character)
- if otherPlayer and client.Character:FindFirstChild'HumanoidRootPart' and character:FindFirstChild'HumanoidRootPart' and client.Character.HumanoidRootPart.Anchored == false and character.HumanoidRootPart.Anchored == false then
- local posA, posB = client.Character.HumanoidRootPart.CFrame, character.HumanoidRootPart.CFrame
- client.Character.HumanoidRootPart.CFrame = posB
- character.HumanoidRootPart.CFrame = posA
- end
- end
- end)
- end))
- LocalScript4.Name = "AnimateCharacterScript"
- LocalScript4.Parent = Script3
- LocalScript4.Disabled = true
- table.insert(cors,sandbox(LocalScript4,function()
- local track = (script:WaitForChild'Humanoid'.Value or script.Humanoid.Changed:wait()):LoadAnimation(script.SwapAnim)
- track:Play()
- wait(1)
- script:Destroy()
- end))
- Animation5.Name = "SwapAnim"
- Animation5.Parent = LocalScript4
- Animation5.AnimationId = "http://www.roblox.com/Asset?ID=78674033"
- ObjectValue6.Name = "Humanoid"
- ObjectValue6.Parent = LocalScript4
- RemoteEvent7.Name = "SwapWith"
- RemoteEvent7.Parent = Tool0
- LocalScript8.Parent = Tool0
- table.insert(cors,sandbox(LocalScript8,function()
- local Tool = script.Parent
- Tool.Enabled = true
- local Players = game:GetService'Players'
- GetCharacterFromPart = function(part)
- local current = part
- local character = nil
- while true do
- for i, child in next, current:GetChildren() do
- if child:IsA'Humanoid' then
- character = current
- break
- end
- end
- if character then
- break
- else
- current = current.Parent
- if not current or current == game then
- break
- end
- end
- end
- return character, character and Players:GetPlayerFromCharacter(character)
- end
- Tool.Equipped:connect(function(mouse)
- mouse.Icon = 'rbxasset://textures/GunCursor.png'
- mouse.Button1Down:connect(function()
- local hit = mouse.Target
- local char = GetCharacterFromPart(hit)
- if char then
- Tool.SwapWith:FireServer(char)
- mouse.Icon = 'rbxasset://textures/GunWaitCursor.png'
- Tool.Enabled = false
- wait(2)
- mouse.Icon = 'rbxasset://textures/GunCursor.png'
- Tool.Enabled = true
- end
- end)
- end)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement