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

this script is supposed to add together 2 int values why doesnt it work?

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
		coins.Value = 0 + str.Value
		
	end
end)

it does not add to the coins value any help is apriciated

2 comments

0

Why are you adding 0 to value? If I am right I predict it should be coins.Value = coins.Value + str.Value.

0

Well if you're adding 0 + the value it only returns the value. It should be leaderstatsValue + str.Value

1 answer

✓ Accepted answer

Change coins.Value = 0 + str.Value too coins.Value = coins.Value + str.Value

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