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

How do I change an IntValue's value when inside a player?

I made a StarterCharacter, with an IntValue inside of the character.

I want the IntValue's value in the character to go up by two when I touch a part.

script.Parent.Touched:Connect(function(plr)
		
	plr.LocalPlayer.Character.Value.Value = plr.LocalPlayer.Character.Value.Value + 2 --Isn't working, and not giving an error.
	
	print("plus 2") --Isn't printing due to line 3 not working
	
end)

2 comments

0

try plr.Parent instead of plr.LocalPlayer.Character

0

The code won't run, because it is in workspace!

1 answer

✓ Accepted answer

Like Donut792 said, use plr.Parent

CHANGE YOUR SCRIPT TO A SERVER SCRIPT!

script.Parent.Touched:Connect(function(plr)

    plr.Parent.Value.Value = plr.Parent.Character.Value.Value + 2 --Isn't working, and not giving an error.

    print("plus 2") --Isn't printing due to line 3 not working

end)

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