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

Why does IntValue.Changed not fire?

I've taken a lot of time off from scripting lately so I'm pretty sure I made a basic mistake but my I have an IntValue inside replicated storage with a script as its child. The code within the script is below:

script.Parent.Changed:Connect(function(newVal)
	print('Changed')
	local timerEvent = game.ReplicatedStorage.Events.TimerChange
	timerEvent:FireAllClients(newVal)
	wait(1)
	timerEvent:FireServer(newVal)
end)

Even the print isn't present in the output. I've tried manually changing the value using the explorer and I've also ran a command in the studio commandline. No matter what I do, the event just isn't being fired.

Thank you in advance.

1 comment

0

Try maybe to put the script under ServerScriptService

2 answers

✓ Accepted answer

Scripts do not run in ReplicatedStorage. Put server scripts in ServerScriptService.

Short answer.

2 comments

1

Ah! I knew I probably made a stupid error after so much time off. Thank you!

0

Don't sweat it. Everyone's asked questions at one point, hell, I'm sure that even Berezaa always has a devwiki tab open at all times.

Try using GetPropertyChangedSignal and I also see a problem with the code below that where you are firing both a client event and server event. I assume the script is a regular server script, that being the case, you cannot fire a server event from a server script. Server scripts fire client events, and client scripts fire server events.

1 comment

0

I changed the code how you said and still received no errors, yet I also haven't had it fire an event despite being changed. Still as lost as ever

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