I have a teleport script inside of a regular script inside of a part. It works fine in studio but in the roblox player. Anyone know a solution?
script.Parent.Parent.touch1.Touched:Connect(function() local player = workspace:FindFirstChild(game.Players.LocalPlayer.Name) wait(.5) player.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(176.303, 1.5, -21.643)) end)
You should get the character from the Touched argument if it’s in a normal script:
script.Parent.Parent.touch1.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("HumanoidRootPart") then wait(0.5) hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(176.303, 1.5, -21.643)) end end)