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

How do you use extra cash giving blocks while in a tycoon leaderboard?

I have a tycoon set up using LinkedLeaderboard script version 5.00 . When you get extra cash from the giver it will not work to purchase items in the tycoon. How would I link the scrips together so that they work?

I need to link my extra cash giver to the tycoon leaderboard. When I touch the giver I get the points. But when I go to purchase something with them they dont work. Im using the same label ("cash") on the giver script, the purchase handler script and the leaderborad. Why wont the money sync together?

5 comments

0

Just sayin, but most people don't want to go through entire scripts like this. If you can, narrow it down a little bit so it's easier for us to work with.

0

Just please cut out a part, where the error is!

0

Is that what you mean?

0

No, lol, we're saying that u need to leave part of the script, but only the part where you think the error is

0

I have no idea where the error is at all. I have no idea why the cash wont work with the purchases even tho its working with the leaderboard.

2 answers

If the LeaderBoard is working then try this: A shop type thing.

Shop thing

local debounce = false
local price = 5 --How much cash it costs

script.Parent.Touched:connect(function(part)
	local plyr = game:GetPlayerFromCharacter(part.Parent)
	local stat = plyr:FindFirstChild("leaderstats")
	local cash = stat:FindFirstChild("Cash")
	if not debounce and plyr and stat and cash and cash.Value >= price then
		debounce = true
		cash.Value = stat.Cash.Value-price
		--Add something here, It's the thing they bought.
		script.Parent:Destroy()
		wait(5) --Delay
		debounce = false
	end
end)

Cash Giver

local debounce = false
local reward = 1000 --How much cash you get

script.Parent.Touched:connect(function(part)
	local plyr = game:GetPlayerFromCharacter(part.Parent)
	local stat = plyr:FindFirstChild("leaderstats")
	local cash = stat:FindFirstChild("Cash")
	if not debounce and plyr and stat and cash then
		debounce = true
		cash.Value = stat.Cash.Value+reward
		wait(5) --Delay
		debounce = false
	end
end)

Leaderstats

If It doesn't show "Cash" in the leader stats do this.

--Kills leaderstats above.
local Cash = Instance.new("IntValue", stat) --Is it stat or stats? Please change
Cash.Name = "Cash"
Cash.Value = 0

You were too vague, sorry If I didn't do what you wanted.

This may help you, but you should be using this method to stop hacking/exploits

Remote Function

All leader board information cannot be accessed or changed from the client (the local player) otherwise this would mean that players can hack your game. Instead all of the leader board information is kept on the server where it is safe.

To change the value on the server you will need to use a remote function which will then change the value on the server.

To test this you need to run roblox studio and go to the test menu and start a server with a player. Check that both value on the server and client match.

Also have a look at filtering it may help explain Filtering

1 comment

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