Hello there!
I’m currently patching my game for the next event and for some reason I’m encountering a bug where if someone joins my game, the item is given which is supposed to happen, and then once the option is disabled it will remove the item after someone resets.
My problem is that once the option gets re-enabled, the item still won’t give to to players at all. I’ve checked the script to see if it sends in data, which it does, but it still wouldn’t give anything. Is there something I’m doing wrong?
Here’s what I have for my scripts:
LocalScript
local GameSettings = Icon.new()
GameSettings:modifyTheme({"Menu", "MaxIcons", 3})
GameSettings:align("Left")
GameSettings:setImage(6022852108)
GameSettings:setImageScale(0.65)
GameSettings:setCaption("Game Settings")
GameSettings:setMenu({
Icon.new()
:autoDeselect(false)
:setLabel("Roof: On", "deselected")
:bindEvent("deselected", function()
game.ReplicatedStorage.Remotes.RoofEnabled:FireServer(0)
end)
:setLabel("Roof Off", "selected")
:bindEvent("selected", function()
game.ReplicatedStorage.Remotes.RoofEnabled:FireServer(1)
end)
,
Icon.new()
:autoDeselect(false)
:setLabel("Daytime: Off", "deselected")
:bindEvent("deselected", function()
game.ReplicatedStorage.Remotes.Daytime:FireServer(0)
end)
:setLabel("Daytime: On", "selected")
:bindEvent("selected", function()
game.ReplicatedStorage.Remotes.Daytime:FireServer(11)
end)
,
Icon.new()
:autoDeselect(false)
:setLabel("Cleans: Off", "deselected")
:bindEvent("deselected", function()
game.ReplicatedStorage.Remotes.CleansAllowed:FireServer(0)
end)
:setLabel("Cleans: On", "selected")
:bindEvent("selected", function()
game.ReplicatedStorage.Remotes.CleansAllowed:FireServer(1)
end)
:select()
,
})
ServerScript
--// Variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage.Remotes
local CleanEvent = Remotes.CleansAllowed
--// Script
CleanEvent.OnServerEvent:Connect(function(player, data)
if data == 1 then
script.CleanGiver.Enabled = true
print("Cleans enabled")
elseif data == 0 then
script.CleanGiver.Enabled = false
print("Cleans disabled")
end
end)