local rc = 50000
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.Money.Value >= rc then if debounce then debounce = false if plr.leaderstats.Money.Value < 20 then return end 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)
that is my script for making players be able to go threw but i need help making it take away money.
This should work! ( I know this is vague and basically just the script but i didnt really know how to answer the question without giving the script xD)
local debounce = false local rc = 50000 script.Parent.Touched:Connect(function(hit) local hum = script.Parent:FindFirstChild("Humanoid") if hum then if debounce == false then debounce = true local player = game.Players:WaitForChild(hum.Parent.Name) player.leaderstats.Money.Value = player.leaderstats.Money.Value - rc script.Parent.Transparency = 0.5 wait(0.5) script.Parent.Transparency = 0 debounce = false else return end end end)