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

this script does not work. why? it's supposed to add together 2 int values

Asked by
seikkatsu 110
4 years ago
script.Parent.Touched:Connect(function(hit)
    local hum = hit.Parent:FindFirstChild("Humanoid")
    local p = game.Players:GetPlayerFromCharacter(hit.Parent)
    local stats = p:FindFirstChild("leaderstats")
    local coins = stats.Coins
    local str = stats.Strenght
    coins.Value = coins.Value + str.Value
end)

any help is apriciated

0
also everything works perfectly fine, exept for the 7th line seikkatsu 110 — 4y
0
@seikkatsu are there any errors in the output? BlackOrange3343 2676 — 4y
0
"Strenght" EmilyBendsSpace 1025 — 4y
0
there aren't any i said that seikkatsu 110 — 4y

1 answer

Log in to vote
0
Answered by
AizakkuZ 226 Moderation Voter
4 years ago
Edited 4 years ago
coins.Value = coins.Value + str.Value

Try using tonumber() Which would look a little like this

coins.Value = tonumber(coins.Value) + tonumber(str.Value)
0
doesn't work... i don't get any error seikkatsu 110 — 4y
0
I'm sorry but, you never actually defined a problem thus I just guessed AizakkuZ 226 — 4y
0
... AizakkuZ 226 — 4y
Ad

Answer this question