Hi. So I was making this game and at one part, there is a door. When you press it, It teleports you to a certain position. However, it’s not working for me; here’s my script (I used CFrame):
script.Parent.Triggered:Connect(function(hit)
local player = hit.Parent:FindFirstChild("Humanoid")
if player then
player.Character.HumanoidRootPart.CFrame = CFrame.new(74, 0.5, 126.25)
end
end)
The hit argument isn’t the BasePart that trigger the prompt, that is for Touched events. The hit argument in this case is the player instance that triggered the prompt.
script.Parent.Triggered:Connect(function(player)
local char = player.Character
local rootpart = char:FindFirstChild("HumanoidRootPart")
if rootpart then
rootpart.CFrame = CFrame.new(74, 0.5, 126.25)
end
end)