Trying to make a button that when the Player completes the obby they can receive say like a 1000 cash from touching a part or something. This needs to some how work with Zednov's Tycoon Kit also.
Firstly, I would like to say that ScriptingHelpers is not a website for requesting scripts. Requesting scripts is against the guidelines of ScriptingHelpers. Anyways, on to actually making the script. In ServerScriptService, create a new script and name it "Leaderstats".
-- Leaderstats game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new("IntValue") -- Container for leaderboard values leaderstats.Name = "leaderstats" leaderstats.Parent = plr local cash = Instance.new("IntValue") cash.Name = "Cash" cash.Value = 0 cash.Parent = leaderstats end)
That script will create a leaderboard. "leaderstats" is a container for values that are displayed on the leaderboard, and "Cash" will be the value displayed. Create a new script in ServerScriptService called "CashScript".
-- CashScript local debounce = false -- Cooldown local part = workspace.Part -- Change to the part you want to give cash local cooldownTime = 1 part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid") if humanoid and not debounce then -- Checking to see if this is something alive and not on a cooldown local playerName = humanoid.Parent.Name -- Getting the name of the character local player = game.Players[playerName] -- Finding out if this is a player if player then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 10 debounce = true -- Makes a cooldown wait(cooldownTime) debounce = false end end end)
I hope this helped. Anyways, please refrain from requesting scripts.