Ok, so I'm making this obby game where you win obbies for points, the player starts with zero points so I made a door so if you have zero or more points you can enter, however, I have checked all the coding and nothing seems to be wrong but it isn't working. Does anyone have a solution and can send me the updated code? Here is the code:
db = false
local min_lev = 0
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if db == false then
db = true
if player.leaderstats.Points >= min_lev then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
wait(.5)
script.Parent.CanCollide = true
script.Parent.Transparency = 0.6
end
db = false
end
end
end)
Thanks!

1 comment
is this in a regular Script or a LocalScript