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

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

Asked by
jixere 2
4 years ago

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.

Closed as Not Constructive by Ziffixture

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 4 years ago
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)
0
Eh Ziffixture 6913 — 4y
Ad