Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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)

Ad

Answer this question