I get a error when I try to change a speed of something when a value is changed. The error stats "attempt to index field 'Value' (a number value)".
When I execute this code I get that error:
fp.Value.Changed:connect(function() for i = 0, 360, 1 do p.Orientation = Vector3.new(0, i, -90) wait(fp.Value) end end)
fp is the NumberValue in ReplicatedStorage.
Before you suggest that I have not attached a value to fp, I have.
Please clarify what that error means and how to avoid it in the future. Thanks :D!
You need to use instance.Changed
not instance.Value.Changed
, if you use instance.Value.Changed
will return this error, for fix this only remove .Value in line 1
Example:
local instance = workspace.MyValue instance.Changed:Connect(function() print("MyValue changed") end)
Also :connect
is deprecated, use :Connect
Fixed script:
fp.Changed:Connect(function() for i = 0, 360, 1 do p.Orientation = Vector3.new(0, i, -90) wait(fp.Value) end end)