This is a teleport script, but for some reason I am getting a "Attempt to index nil with name Line 5" and I don't know why. Any help is really appreciated!
local Pad = game.Workspace.SecuritySystem.Pad2
script.Parent.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
local Name = Player.Name
if Player then
local CurrentlyTeleporting = Player.Character:FindFirstChild("CurrentlyTeleporting")
if not CurrentlyTeleporting then return end
if not CurrentlyTeleporting.Value then
CurrentlyTeleporting.Value = true
Player.Character.HumanoidRootPart.CFrame = Pad.CFrame + Vector3.new(0,5,0)
print(Name,"tried to rob the bank while cooldown was active.")
wait(3)
CurrentlyTeleporting.Value = false
end
end
end)
