Sorry but his/her script was wrong have u tried typing in mine or the other guys?
.Activated
will also work for GUIs.
Iphone scripts are not the best
But if you know it better do your thing.
Finally Thank u so much guys I managed to do it! I am kinda new to scripting so im sorry if this took u some time
And u should say player.leaderstats.cash.value = player.leaderstats.cash.value +10
That’s okay! :))
30 charsssssssss
It’s the “new” compound assignment operator thing.
It’s alright aaaaaaaaaaaaaaaaaaaaaa
Does it all works correctly?
Oh well thank u for the input 30 charssss
Yea I also put a wait on so it gives cash like ever 120 seconds ima also make the textlabel change when this is completed it will say come back in 2 hours to redeem it again. Again thank u so much!
Can you mark my answer as a solution pls? :))
I used what ThoseNamesAreGood said like I did whatever he said
I thought it was a team effort but okay…
Okay ima go now thank u so much!
No message me if u need anything else!
I meant no problem sorry I made. Typa
Typo 30 charssssssssssssssssssssssss
Here you go I finally got it working Try This place the Local Script inside the TextButton
local player = game.Players.LocalPlayer
local PlayerCash = player.leaderstats.Cash
script.Parent.MouseButton1Click:Connect(function(player)
PlayerCash.Value = PlayerCash.Value + 1
end)
You shouldn’t use StarterGui it should be PlayerGui
this is the way how you get PlayerGui
local player = game.Players.LocalPlayer
local PlayerGui = player.PlayerGui
PlayerGui.ScreenGui.TextButton.MouseButton1Click:Connect(function()
-- your code here
end)
you can type this instead of above by insert script inside your button
script.Parent.MouseButton1Click:Connect(function()
-- your code here
end)
and yes You can set value from LocalScript but Server will count it as default to do this
i recommend to use RemoteEvent
and fire
localscript:
local remoteevent = where you inserted you remotevent
local givecash = 50 -- cash you want to give
script.Parent.MouseButton1Click:Connect(function()
remoteevent:FireServer(givecash)
end)
NormalScript:
Put this one ins serverscriptservice
local remoteevent = where you inserted your remoteEvent-- same as local script
remoteevent.OnServerEvent:connect(function(player,giveCashValue))
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 10
end)
and check mark the person who’ve made the solution too ;c