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

How do I make a Obby for Cash? - Zednov's Tycoon Kit

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.

1 answer

✓ Accepted answer

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.

3 comments

0

Thanks! My bad I haven't read the guidelines very closely, but I won't make the mistake again :) Thanks for the help though!!

0

By the way did you mean ServerScriptService? Because ServerScriptStorage is not a thing I think? Idk I'm just gonna take a guess and put these scripts in ServerScriptService :)

0

I meant ServerScriptService, not ServerScriptStorage. :P

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