Robux giver isn't working

Hello! I’m trying to make it so it gives the player my in-game currency of robux, every 10 seconds when their touching the player or players then, it will give the local player or players ( the player or players who are touching the Invisible block with no collision ) then gives them 5 robux every 20 secs, the script doesnt work tho here’s what came inside the output

The Output

  11:08:21.605  The Roblox Economy auto-recovery file was created  -  Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
  11:08:22.955  Workspace.BuyColaButton1.BuyerHandle:60: Expected 'end' (to close 'then' at line 8), got <eof>; did you forget to close 'then' at line 39?  -  Studio - BuyerHandle:60
  11:08:35.463  Workspace.MoneyMakingZoneBloxy,BloxyCorners.RobuxHandler:3: attempt to index nil with 'leaderstats'  -  Server - RobuxHandler:3
  11:08:35.464  Stack Begin  -  Studio
  11:08:35.464  Script 'Workspace.MoneyMakingZoneBloxy,BloxyCorners.RobuxHandler', Line 3  -  Studio - RobuxHandler:3
  11:08:35.464  Stack End  -  Studio
  11:08:37.772  0.5, 0.5  -  Server
  11:08:38.078  0.5, 0.5  -  Client

The Script

if game.Workspace["MoneyMakingZoneBloxy,BloxyCorners"].Touched then
	wait(20)
	game.Players.LocalPlayer.leaderstats.Robux.Value = game.Players.LocalPlayer.leaderstats.Robux.Value + 5
end

Try doing

game.Players.LocalPlayer:WaitForChild('leaderstats').Robux.Value = game.Players.LocalPlayer:WaitForChild('leaderstats').Robux.Value + 5
1 Like

Like this?

if game.Workspace["MoneyMakingZoneBloxy,BloxyCorners"].Touched then
	wait(10)
	game.Players.LocalPlayer:WaitForChild('leaderstats').Robux.Value = game.Players.LocalPlayer:WaitForChild('leaderstats').Robux.Value + 5
end

Yes, maybe when you try to require this, it is just not loaded.

1 Like

I would change the name of your in-game currency to anything but “ROBUX”. It might be mistaken by mods as a scam.

2 Likes

Hey, @StarJ3M :wave:

I’m not sure how to help with this, sorry, however - I would not recommend changing leaderstats on the Client, this means that the server cannot see your Robux Value, only the Client.

If you’re handelling your economy on the client, this is a large open gate for Exploiters to give themself Robux by simply running game.Players.LocalPlayer.leaderstats.Robux.Value = game.Players.LocalPlayer.leaderstats.Robux.Value + 1000000000000 on their Executor.

1 Like
  12:23:03.491  Workspace.MoneyMakingZoneBloxy,BloxyCorners.RobuxHandler:3: attempt to index nil with 'WaitForChild'  -  Server - RobuxHandler:3
  12:23:03.492  Stack Begin  -  Studio
  12:23:03.492  Script 'Workspace.MoneyMakingZoneBloxy,BloxyCorners.RobuxHandler', Line 3  -  Studio - RobuxHandler:3
  12:23:03.492  Stack End  -  Studio
  12:23:06.488  0.5, 0.5  -  Server
  12:23:06.757  0.5, 0.5  -  Client

Is it a script or local script? :grinning_face_with_smiling_eyes:

script


Should I tix instead?


This should be a LocalScript. You can’t get LocalPlayer from a normal script. That’s why it’s erroring.