Hiding function does not work

I’m trying to make a prompt, which when triggered, teleports the player to the Teleport part. But this does not work nor output showing any errors. Any solutions?

local prompt = script.Parent.ProximityPrompt
local tpIn = script.Parent.Parent.InPart
local tpOut = script.Parent.Parent.OutPart

local hiding = false

prompt.Triggered:Connect(function(trigger)
	local root = trigger.Parent:FindFirstChild("HumanoidRootPart")
	if root and hiding == false then
		root.CFrame = tpIn.CFrame
		hiding = true
	elseif root and hiding == true then
		root.CFrame = tpOut.CFrame
		hiding = false
	end
end)

The Triggered event returns Player object, it doesn’t work like Touched event.

Try this:

local character = trigger.Character
local root = character:FindFirstChild("HumanoidRootPart")
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.