Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i remove money when The player clicks on a TextButton? [SOLVED]

I got an answer from ROBLOX forums.

local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function() Player.leaderstats.cash.Value = Player.leaderstats.cash.Value - 5000 end)

Incase anyone needs it.

1 answer

Just Use LocalPlayer

button = script.Parent
window = script.Parent.Parent.Parent.Parent
local sp = game.Players.LocalPlayer
function onClicked(GUI)
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.LowEndPC.Visible = true
cash = sp.leaderstats.Money.Value
if cash.Value >= 15000 then
cash.Value = cash.Value- 5000
end
end
script.Parent.MouseButton1Click:connect(onClicked)

This discussion is preserved as it was. New answers, comments, and votes are closed.