Hello! I’m trying to make some setting so I can stop the player from growing whenever the setting is turned off and vice versa, but on the client side of the remote function I send two parameters, the player and “Growth”, however the client sends nil and the server recieves nil… I can’t figure this out.
Client Script:
local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
script.Parent.MouseButton1Click:Connect(function(plr)
print("Button Presed!")
local result = ReplicatedStorage:WaitForChild("Events"):WaitForChild("SettingOnOff"):InvokeServer(plr, "Growth")
print(result)
if result == "OFF" then
print("Off")
button.BackgroundColor3 = Color3.fromRGB(255, 48, 48)
button.Text = "OFF"
elseif result == "ON" then
print("On")
button.BackgroundColor3 = Color3.fromRGB(112, 255, 80)
button.Text = "ON"
end
end)
Server Script:
ReplicatedStorage.Events.SettingOnOff.OnServerInvoke = function(player, setting)
local settingsFolder = player:FindFirstChild("Settings")
print(setting)
if setting == "Growth" then
print("Setting value found!")
for i, setting_ in pairs(settingsFolder:GetChildren()) do
print("Loop started "..setting_)
if setting_ == setting then
print("Names equal")
if setting_.Value == true then
print("Setting set to False")
setting_.Value = false
return "OFF"
else
print("Setting set to True")
setting_.Value = true
return "ON"
end
end
end
end
end
Output: