while wait(0.001) do
local required_points = 100000
local db = true
script.Parent.Touched:connect(function(hit)
local player = hit.Parent
if hit.Parent:FindFirstChild("Humanoid")then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.leaderstats.Coins.Value >= required_points then
if db then
db = false
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
end
else
print("you haven't enough money")
end
end
end)
end
idk why it is not working it is working in a normal script but the problem is that a other players can go threw when a player with 100K touches the door

1 comment
local scripts can't run in the workspace unless they are under a character rig associated with a player object