So, I’m working on a team-based obby, and some of the teleporters to different obbies required a certain amount of wins. However, whenever I have tried testing them, say I have less than the required amount of wins, it still teleports me to the obby. I’m unsure if it is because of something I’m missing, or I am writing the script completely wrong. Here is the script below:
local Pad = game.Workspace.TwoPlayerObbies.Level5:FindFirstChild("Level5Pad")
local Teleporter = script.Parent
local requiredWins = 5
Teleporter.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local winsValue = player:FindFirstChild("Wins")
if winsValue and winsValue.Value >= requiredWins then
local humanoidRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.CFrame = Pad.CFrame + Vector3.new(0, 5, 0)
end
else
print("Player does not have enough wins to teleport.")
end
end
end)
If there’s something I’m missing from this script, or if it is completely incorrect based on what I’m trying to use it for, please let me know!