Intvalue Script Not Working

I’m trying to make a script change an intvalue to 1 and this is what I got so far but it doesn’t do anything

2 Likes

Any errors appearing in the output?

it says attempt to call a number value in red

Are you sure that script.Parent.D1L.Value is an intvalue?

You have to add a task.wait() cooldown, so it doesnt crash your game…
Is this a local script, where is it located?
Is this a server script, where is it located?

Yeah it is, and its a regular script inside the same model as D1L
Capture

Why are you using a while loop, are you trying to add the value by 1 each second?

no I’m trying to make it change from 1, 3 then 2 and 1 (Red, Green, Yellow then Red). its a traffic light I’m trying to program

You can use a bindable event.

local Lights = {
	["Green"] = 3,
	["Yellow"] = 2,
	["Red"] = 1
}
local Event:BindableEvent? = script.Parent.ChangeLight
Event.Event:Connect(function(Light)
	script.Parent.D1L.Value = Lights[Light]
end)
--Other script
local Event:BindableEvent? = script.Parent.ChangeLight
Event:Fire("Green")

You can fire it with the appropriate color being the argument.

for some reason it doesn’t work

17:31:23.009 ChangeLight is not a valid member of Model “Workspace.SignalKit” - Server - Script:6

You have to make a bindable event in signalkit.
image

oh ok but still its not changing D1L to 1

Are you firing it with red?
it should be Event:Fire("Red")

when I press run, the intvalue sits on 0 and does nothing