Hello.
I am currently trying to make a Portal only teleport the player if they've met some conditions. This does work, however, the part won't actually detect the player unless you step on the part multiple times. I'm not sure what's causing this, and it's very confusing.
My Script:
local Players = game:GetService("Players")
local Portal = workspace["Portal of Life1"]
local Died = false
local Debounce = false
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.FadeRemote
Players.PlayerAdded:Connect(function(Player)
print("Player added")
Player.CharacterAdded:Connect(function(Character)
print("Character added")
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
print("Player died")
Died = true
end)
end)
end)
Portal.Core.Touched:Connect(function(ObjectCollided)
if not (Debounce) then
Debounce = true
local PlayerHumanoid = ObjectCollided.Parent:FindFirstChildWhichIsA("Humanoid")
local Player = Players:GetPlayerFromCharacter(ObjectCollided.Parent)
if (Died and Player) then
print("Passed step")
ObjectCollided.Parent.Humanoid.WalkSpeed = 0
print("Yes")
ObjectCollided.Parent.IsTeleporting.Value = true
Remote:FireClient(Player)
wait(14)
ObjectCollided.Parent.HumanoidRootPart.CFrame = CFrame.new(-566.43, -97.266, 202.748)
wait(1)
ObjectCollided.Parent.IsTeleporting.Value = false
end
wait(1)
Debounce = false
end
end)
I'm not sure why this happens and would like some help. Thanks!

1 comment
Worked. Thanks!