Change Player Values with local script (server-side)

is there any error , cuz it didnt work .

the value is in the player folder “Settings” , it’s a bool value

server script

local event = game.ReplicatedStorage.ChangeValues

event.OnServerEvent:Connect(function(player, Settings, newVal)
	player:WaitForChild(Settings).Shadows.Value = newVal
end)

local script

local event = game.ReplicatedStorage.ChangeValues
local isOn = false

script.Parent.MouseButton1Click:Connect(function()
	if isOn == false then
		isOn = true
		script.Parent.Text = "ENABLED"
		game.Players.LocalPlayer.Settings.Shadows.Value = true
		game.Lighting.GlobalShadows = true
		event:FireServer("Shadows", true)
	else
		isOn = false
		script.Parent.Text = "DISABLED"
		game.Players.LocalPlayer.Settings.Shadows.Value = false
		game.Lighting.GlobalShadows = false
	end
end)

Yes, in the server script the script should be this for your case:

event.OnServerEvent:Connect(function(player, value, newVal)
player:WaitForChild("Settings"):FindFirstChild(value).Value = newVal
end)
3 Likes