Values don't update through server scripts

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’d like my script to change the number inside of a value when I press a button.

  2. What is the issue? Include screenshots / videos if possible!
    The button function works fine, but the value does not update.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve looked on the DevForums but pretty much everyone is asking how to change a value locally.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local ClickDetc = script.Parent:WaitForChild("ClickDetector")
local Value = script.Parent.Parent.Parent:WaitForChild("Sirens").Value


ClickDetc.MouseClick:Connect(function(player)
	Value = 1
	ClickDetc.MaxActivationDistance = 0
	wait(5)
	ClickDetc.MaxActivationDistance = 32
	Value = 0
end) ```


I’ve only added the vars that seem needed. As said, the entirety of the script is working fine besides the “Value = 1” or “Value = 0”

I honestly feel like this is a really easy question, but I am just stumped.

I had a similar problem before, try changing this:

local Value = script.Parent.Parent.Parent:WaitForChild("Sirens") -- removed .Value

ClickDetc.MouseClick:Connect(function(player)
	Value.Value = 1 -- .Value added here
	ClickDetc.MaxActivationDistance = 0
	wait(5)
	ClickDetc.MaxActivationDistance = 32
	Value.Value = 0 -- .Value added here
end) 
1 Like

May I ask if this is a Server Sided Script or a Local Sided Script? Also, is it perhaps working if you do script.Parent.Parent.Parent["Sirens"].Value = ... ?

1 Like

Literally why :sob:

Summary

not enough letters abcdefg

This is a server sided script. The script is for a gate that has a light with another script that makes the light function, but the light only looks for a value. (I’m just using some free model that I found off of the toolbox)

I think it’s becouse [anyValue].Value means only true or false, you can’t introduce a value with just .Value becouse it needs to be true or false. Hope this is quite understanding.

It’s like not finishing a full phrase

1 Like

Ahh! Now this makes sense!! I’ve never used values that much with scripting, so this is like a whole new part for me!! Thank you so much for the help!

1 Like

No problem! Have fun in your scripting journey!

1 Like