Hello,Im trying to do a recoil script and I did a local and a serverscript.But when I change the value in the tool in the local script,the script in the tool still says that it's false.
Local Script:
mos.Button1Up:Connect(function() basilli = false script.Parent.Server.Basilli.Value = false end) script.Parent.Activated:Connect(function() basilli = true script.Parent.Server.Basilli.Value = true repeat wait() local FireDirection = (Mouse.Hit.Position - FirePointObject.WorldPosition).Unit MouseEvent:FireServer(FireDirection) until basilli == false end)
Server Script:(just that line)
while wait() do print(script.Basilli.Value) if script.Basilli.Value == true then MAX_BULLET_SPREAD_ANGLE = 10 end end
Changes on the client don't replicate to the server. You can use the remote event you fired to send the value to the server and change it.
--Client MouseEvent:FireServer(FireDirection, script.Basilli)
then:
--Server MouseEvent.OnServerEvent:Connect(function(player, FireDirection, Basilli) -- the player is always the first parameter of OnServerEvent Basilli.Value = true --the server will see this and will therefore change for the server and not just the client. end)
Please accept the answer if I solved your problem!