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

why doesn't my script work? its supposed to add 2 int values together

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
        if p and stats and str and coins then
            if str.Value > 0 then
                coins.Value = coins.Value + str.Value
            end
        end
    end
end)

the issue here is that the int values don't add up together any ideas?

0
add prints to see where it stops running then shows us the output BlackOrange3343 2676 — 5y
0
Yeah do what orange said. XxWingKing 96 — 5y
0
spelled strength wrong btw :) ForeverBrown 356 — 5y
0
yeah i know it's okay seikkatsu 110 — 5y
0
Are you sure str.value is actually > 0? SerpentineKing 3885 — 5y

1 answer

Log in to vote
0
Answered by
sifn 70
5 years ago

local str = stats.Strenght

It doesnt look like 'strength' is spelled correctly here, this might be the problem

0
it isn't seikkatsu 110 — 5y
0
the problem is at line 11 seikkatsu 110 — 5y
0
Did you correct the spelling error at line 6 though? sifn 70 — 5y
0
yeah i did seikkatsu 110 — 5y
Ad

Answer this question