I've used a remote event which changes a NumberValue which represents the speed of a vehicle in the workspace. It is fired by a local script which passes the speed of the vehicle as the 2nd parameter, this occurs every frame. I want it to change the NumberValue server wide so it can be read by other scripts in the workspace but, this doesn't happen.
--local script local changeSpeedEvent = seat.Parent.Parent:WaitForChild("SpeedChange") local RunService = game:GetService("RunService") RunService.Heartbeat:Connect(function() changSpeedEvent:FireServer(setSpeed)
--Listener script local SpeedChangeEvent = script.Parent.SpeedChange local speed = script.Parent.Speed.Value SpeedChangeEvent.OnServerEvent:Connect(function(player,newSpeed) speed = newSpeed end)
In server script line 4, you are changing value of local speed variable, instead of referencing NumberValue:
local speed = script.Parent.Speed.Value
What you should do instead is:
--Listener script local SpeedChangeEvent = script.Parent.SpeedChange local speed = script.Parent.Speed --copy reference, instead of value SpeedChangeEvent.OnServerEvent:Connect(function(player,newSpeed) speed.Value = newSpeed --set value here end)