I have a script, that requires sufficient credit in order to pass through a door. But it should only charge once:
script.Parent.Touched:connect(function(player) --Door gets touched humanoid = player.Parent:FindFirstChild("Humanoid") --If it's the player that touched the door if humanoid ~= nil then person = game.Players:FindFirstChild(player.Parent.Name) touched = script.Parent:FindFirstChild(player.Parent.Name) if person ~= nil and touched == nil then person.leaderstats.Admins.Value = person.leaderstats.Admins.Value - 1 --Decreases the credits a = Instance.new("StringValue", script.Parent) a.Name = player.Parent.Name script.Parent.CanCollide = false wait(2) script.Parent.CanCollide = true elseif touched ~= nil then script.Parent.CanCollide = false wait(2) script.Parent.CanCollide = true else humanoid.Health = 0 end end end
i would use a table to store the people who already paid, or whatever, and after they go through the door, their name or userId is put inside the table so they can never use the door again, if thats what your asking.