Basically I am practicing game development, and I’m trying to make a proximity prompt that changes the player’s character
Here is the script
local prompt = script.Parent
local characterName = "Morph"
local character = prompt.Parent:WaitForChild(characterName)
prompt.Triggered:Connect(function(obj)
local plr = game.Players:GetPlayerFromCharacter(obj.Parent)
local charClone = character:Clone()
charClone.Name = plr.Name
plr.Character = charClone
local rootPart = charClone:FindFirstChild("HumanoidRootPart") or charClone:FindFirstChild("Torso")
local plrRoot = obj.Parent:FindFirstChild("HumanoidRootPart") or obj.Parent:FindFirstChild("Torso")
if rootPart and plrRoot then
rootPart.CFrame = plrRoot.CFrame
end
charClone.Parent = workspace
wait(.5)
end)
Can anyone help me solve this issue?