I've got this code to change between custom characters by touching a brick but I want to change it so that you morph characters when you click a gui button.
local bounce = true script.Parent.Touched:connect(function(partT) local x = game.Players:GetPlayerFromCharacter(partT.Parent) if x then if bounce ~= false then local part = partT.Parent local find = game.Players:FindFirstChild(part.Name, true) if find then local player = find local pos = Instance.new("Part",workspace) pos.CanCollide = false pos.Anchored = true pos.Position = player.Character.HumanoidRootPart.Position if player.Character and player.Character.Parent then player.Character:Destroy() end local body = script.Parent.Parent.Char:Clone() -- detect char local unarch = body:GetChildren() for i,v in pairs(unarch) do if v:IsA("BasePart") then v.Anchored = false end end body.Name = player.Name player.Character = body body.Parent = game.Workspace body.HumanoidRootPart.CFrame = CFrame.new()*CFrame.new(pos.Position) body.HumanoidRootPart.Anchored = false pos:Destroy() local character = body end end end bounce = false wait(15) bounce = true end)
thanks for any replies :)