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

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

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?

5 comments

0

add prints to see where it stops running then shows us the output

0

Yeah do what orange said.

0

spelled strength wrong btw :)

0

yeah i know it's okay

0

Are you sure str.value is actually > 0?

1 answer

local str = stats.Strenght

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

4 comments

0

it isn't

0

the problem is at line 11

0

Did you correct the spelling error at line 6 though?

0

yeah i did

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