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

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

Asked by 9 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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?

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. dyler3 1510 — 9y
0
Just please cut out a part, where the error is! woodengop 1134 — 9y
0
Is that what you mean? brooksdart 5 — 9y
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 dyler3 1510 — 9y
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. brooksdart 5 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

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.

Ad
Log in to vote
0
Answered by 9 years ago

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

Answer this question