of     1   

rockinnoobs
#155157586Monday, February 02, 2015 2:57 AM GMT

I am trying to make a gui button that will give a player money when clicked. This is the code I have: Cash Stat Script: game.Players.PlayerAdded:connect(function(player) stat = Instance.new("IntValue") stat.Name = "leaderstats" stat.Parent = player cash = Instance.new("IntValue") cash.Name = "Cash" cash.Parent = stat end) Give player money button: moneyToGive = 5 debounce = false function onClicked(playerWhoClicked) if debounce == true then return end player = game.Players:GetPlayerFromCharacter(hit.Parent) if player == nil then return end stat = player:findFirstChild("leaderstats") if stat == nil then return end cash = stat:findFirstChild("Cash") if cash == nil then return end debounce = true cash.Value = cash.Value + moneyToGive wait(300) debounce = false end It also doesn't show the loading so that the player has to wait before getting money: local Gui = game.Lighting.GUI --Replace this with the location of your GUI function GiveGui(Player) if Player.PlayerGui:FindFirstChild(Gui.Name)~=nil then return end Gui:Clone().Parent=Player.PlayerGui end script.Parent.Touched:connect(function(hit) local Player=game.Players:GetPlayerFromCharacter(hit.Parent) if Player==nil then return end GiveGui(Player) end)
rockinnoobs
#155185947Monday, February 02, 2015 3:54 PM GMT

Come on. 12 people viewed yet no one said a thing. I would like to finish this soon.
rockinnoobs
#155198313Monday, February 02, 2015 7:57 PM GMT

Bump
championbuilder
#155198776Monday, February 02, 2015 8:04 PM GMT

Maybe you'll get help if you post a script you made.
rockinnoobs
#155201565Monday, February 02, 2015 8:47 PM GMT

Are you trying to say it's a bad thing? I've been editing these from the sources I found them at for hours, and no matter what I try it doesn't work. I thought the roblox community where supposed to help. I just am trying to finish this script and the best thing your doing for me is bring my post up higher. Don't comment unless your helping.
championbuilder
#155201902Monday, February 02, 2015 8:52 PM GMT

Maybe if you tell us the directory of the button, we might be able to make one for you.
rockinnoobs
#155202030Monday, February 02, 2015 8:54 PM GMT

I have it under StarterGui. Its a screen gui with a Textbutton on the side with 2 scripts. one for a job loading sequence I guess you could say, and another one that gives the play the money. These scripts work on a brick, but not on a button even though I change it to OnClick.
championbuilder
#155202323Monday, February 02, 2015 8:59 PM GMT

Put this in the button script.Parent.MouseButton1Down:connect(function() local player = game.Players.LocalPlayer local stats = player.leaderstats local cash = stats.Cash money = 5 cash.Value = cash.Value + money end)
rockinnoobs
#155203075Monday, February 02, 2015 9:09 PM GMT

Thank you so much! Now I just have one last question, would it work if I added wait() in to that code so that the play can't spam his money? I just tried to but it just made the timing for it off by a lot. Also, this may be pushing it but that loading code I had didn't really work on the button either. If it isn't a pain could I maybe have some help with that to?
rockinnoobs
#155221589Tuesday, February 03, 2015 1:05 AM GMT

Your script amazing! But it can be spammed and keeps giving the player money but I can't figure out how to get the wait function to work. Could you maybe add this real quick?
rockinnoobs
#155266789Tuesday, February 03, 2015 10:03 PM GMT

bump, Sorry for double bumping!
Provisione
#155273078Tuesday, February 03, 2015 11:34 PM GMT

I know C++, C, JavaScript, HTML, CSS, NOT LUA But you could try and add a wait(.5) or something, maybe then it cant get spammed.
rockinnoobs
#155274303Tuesday, February 03, 2015 11:51 PM GMT

I tried that, all it does is wait 5 seconds, and still allow player stop be spammed. I want it so that the player can click it, then have to wait a minute before clicking it again.
rockinnoobs
#155280140Wednesday, February 04, 2015 1:12 AM GMT

I figured it out! I did a little bit of digging and found a free model that adds money to there cash every 5 minutes.
wolf_prefab
#155283388Wednesday, February 04, 2015 1:54 AM GMT

ew a free model? why not just use Os Time?
wolf_prefab
#155283508Wednesday, February 04, 2015 1:55 AM GMT

ew, a free model? why not just use the internal clock such as os time?
wolf_prefab
#155283552Wednesday, February 04, 2015 1:56 AM GMT

sry fur duble p0st
YoBoiDevDerpy
#155285255Wednesday, February 04, 2015 2:17 AM GMT

how many parents does the script have until it gets to StarterGui?
YoBoiDevDerpy
#155285445Wednesday, February 04, 2015 2:19 AM GMT

NVM debounce = false script.Parent.MouseButton1Down:connect(function() if debounce == false then debounce = true local player = game.Players.LocalPlayer local stats = player.leaderstats local cash = stats.Cash money = 5 cash.Value = cash.Value + money wait(.5) debounce == false end)
rockinnoobs
#155318302Wednesday, February 04, 2015 7:42 PM GMT

These post are way to late. I already released the game I was working on in the time you replied. SELF ADVERTISMENT! www.roblox.com/Forum/ShowPost.aspx?PostID=155318221
YoBoiDevDerpy
#155391896Thursday, February 05, 2015 11:51 PM GMT

ewwwww cheap town rp
rockinnoobs
#155451860Friday, February 06, 2015 11:38 PM GMT

ewww 10 year old judging a book by its covered

    of     1