Hello! So I have a door script here that the rc (required cash) is supposed to be 5k to enter but the thing is that when someone opens it, every noob can go through that door. I've thought of making something like closing after going through it, but it would close forever so I'm left with the door that lets anyone enter even if they dont have 5k
TL;DR someone with 5k cash goes through door, then everybody can go through that door.
local rc = 5000
local debounce = true
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.leaderstats.Cash.Value >= rc then
if debounce then
debounce = false
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
if rc.Value <= rc then
script.Parent.Transparency = 0.15
script.Parent.CanCollide = true
end
end
end
end
end)

1 comment
forgot to mention. It's a script so that might be the problem. I thought of doing LocalScript but it ends up not working at all