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

How do i make it so that when i step on a block, it changes my leaderstat to a dif #?

For example, i would get a block, and lets say you want 1 point. It changes your leaderstats into "1." Lets say ive decided 50 instead; instead of me having 51, it would change from 1 to 50.

1 answer

local function ChangeCash(player,amount) -- Create function
	if player ~= nil and amount ~= nil then -- if player and cash exist then
		player.leaderstats.Cash.Value = amount -- set players cash to amount change player.leaderstats.Cash to what/wherever your cash is stored.
	end
end
--You can then set a players cash using ChangeCash(player,50). However you get player is up to you, but I've provided a very basic example below.

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		ChangeCash(game.Players:FindFirstChild(hit.Parent.Name),50)
	end
end)

1 comment

0

Eh

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