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

this script is supposed to add together 2 int values why doesnt it work?

Asked by
seikkatsu 110
5 years ago
local d = 0
script.Parent.Touched:Connect(function(hit)
    local h = hit.Parent:FindFirstChild("Humanoid")
    local p = game.Players:GetPlayerFromCharacter(hit.Parent)
    local stats = p:FindFirstChild("leaderstats")
    local str = stats.Strenght
    local coins = stats.Coins
    if h and d == 0 then
        coins.Value = 0 + str.Value

    end
end)

it does not add to the coins value any help is apriciated

0
Why are you adding 0 to value? If I am right I predict it should be coins.Value = coins.Value + str.Value. Yuuwa0519 197 — 5y
0
Well if you're adding 0 + the value it only returns the value. It should be leaderstatsValue + str.Value User#29913 36 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Change coins.Value = 0 + str.Value too coins.Value = coins.Value + str.Value

Ad

Answer this question