Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

4 comments

0

also everything works perfectly fine, exept for the 7th line

0

@seikkatsu are there any errors in the output?

0

"Strenght"

0

there aren't any i said that

1 answer

coins.Value = coins.Value + str.Value

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

coins.Value = tonumber(coins.Value) + tonumber(str.Value)

3 comments

0

doesn't work... i don't get any error

0

I'm sorry but, you never actually defined a problem thus I just guessed

0

...

This discussion is preserved as it was. New answers, comments, and votes are closed.