Cannot use proximity prompt twice after teleporting players

Proximity prompt does not work twice after teleporting the players, why? the rest of the script which is pretty long works perfectly fine until those functions run, and if i remove whats inside of those, then i can use the proximity prompt

but if i teleport the players, then i cant anymore, why?

local function teleportPlayers1(regionPart)
	local collisions = workspace:GetPartsInPart(newP, filter)
	
	for i, v in pairs(collisions) do
		print(v.Name)
		if v.Name == "HumanoidRootPart" then
			local humanoidRootPart = v
			humanoidRootPart.Position = humanoidRootPart.Position + Vector3.new(0, 24, 0)
		end
	end
end

local function teleportPlayers2(regionPart)
	local collisions = workspace:GetPartsInPart(newP2, filter)

	for i, v in pairs(collisions) do
		print(v.Name)
		if v.Name == "HumanoidRootPart" then
			local humanoidRootPart = v
			humanoidRootPart.Position = humanoidRootPart.Position + Vector3.new(0, -24, 0)
		end
	end
end

i have seen this post which has a similar issue but their problem is related to gui, which i don’t use here, so i don’t know how remote events can help in this when the rest of the script works perfectly fine by the server, i just can’t use the proximity prompts again after being teleported which is weird

changing the Position of the rootpart can break the character and other stuff, try changing the CFrame instead of the Position

1 Like

Oh i see, i’m not really used with CFrame so how can i simply teleport the player 24 studs above? i tried to do this

local humanoidRootPart = v
local char = humanoidRootPart.Parent
char:SetPrimaryPartCFrame(CFrame.new(0 , 24, 0))

but it teleports the player back to cord 0, 24, 0 instead of only teleporting the character 24 studs above while keeping its original position just like vector3 does, how do i keep the original position while moving them 24 studs above?

its almost the same as using .Position

humanoidRootPart.CFrame += Vector3.new(0, 24, 0)
1 Like

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