I'm new at scripting, and already I make mistakes.
So I get this problem
18:26:38.318 - Workspace.Script:3: attempt to index global 'IntValue' (a nil value)
whenever executing this script.
am = Workspace.AmmoCrate1.AmmoCrate while true do wait(10) am.IntValue = IntValue.new(500) end
You need to change the Value of the IntValue.
If you would like to reset the value to 500, you would do it like this:
am.IntValue.Value = 500
If you would like to add 500 to the current Amount, you would do it like this:
am.IntValue.Value = am.IntValue.Value + 500
Your problem is line 5
am.IntValue = IntValue.new(500)
.new is used for creating new Instances. Example
a = Instance.new("Part")
To add 500 you would do
am.IntValue.Value = am.IntValue.Value +500
Line five is the problem, now I am not sure what you want.
Are you trying to create an IntValue and then assign it a value of 500? Answer:
value = Instance.new("IntValue", am) value.Value = 500
Or are you trying to assign the value of 500 to an IntValue that already exisits? Answer:
am.IntValue.Value = 500
Good luck.