im making a script that if the value of a stats is 1, then will be teleported to other place, but dont work, what i did wrong?
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local h = hit.Parent:findFirstChild("Humanoid")
local thisplr = game.Players:findFirstChild(h.Parent.Name)
local stats = thisplr:findFirstChild("stats")
local cash = stats:findFirstChild("BornZone")
if cash.Value == 1 then
game:GetService("TeleportService"):Teleport(1225966253, player)
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Have if statement checking if its even a player touching, line 4 is unnessesary, FindFirstChild is capitalized. Try changing those three thingies