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
01local d = 0
02script.Parent.Touched:Connect(function(hit)
03    local h = hit.Parent:FindFirstChild("Humanoid")
04    local p = game.Players:GetPlayerFromCharacter(hit.Parent)
05    local stats = p:FindFirstChild("leaderstats")
06    local str = stats.Strenght
07    local coins = stats.Coins
08    if h and d == 0 then
09        if p and stats and str and coins then
10            if str.Value > 0 then
11                coins.Value = coins.Value + str.Value
12            end
13        end
14    end
15end)

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