Hi there! I’m BluestOfFlames, and I’m having a little bit of trouble with my script(s).
Any and all help is appreciated!
I have a Home Screen Function, and the server and client communicate to activate it through remote events. The function is mostly made up of 3 different functions; However they all have the same problem, so I’ll just show one
local function GUIhovers() --Hover system
print("GUI function")
local NewColor = Color3.new(0.545098, 0.545098, 0.545098) --Define Color Codes
local OldColor = Color3.new(1, 1, 1)
local function MouseEntered(GuiObject)
GuiObject.TextColor3 = NewColor
end
local function MouseLeaved(GuiObject)
GuiObject.TextColor3 = OldColor
end
PlayButton.MouseEnter:Connect(function()
print("PLay Button is Hovered Over")
MouseEntered(PlayButton)
end) --enact hovers
EndingsButton.MouseEnter:Connect(function()
MouseEntered(EndingsButton)
end)
UpdateLogButton.MouseEnter:Connect(function()
MouseEntered(UpdateLogButton)
end)
PlayButton.MouseLeave:Connect(function()
MouseLeaved(PlayButton)
end)
EndingsButton.MouseLeave:Connect(function()
MouseLeaved(EndingsButton)
end)
UpdateLogButton.MouseLeave:Connect(function()
MouseLeaved(UpdateLogButton)
end)
end
Here is the remote event which the client uses to tell the server to continue.
ReadyToCon:FireServer() --Fire server to continue
Here is the receiving function for that remote event.
ReadyToCon.OnServerEvent:Connect(function() --Activate Gui homescreen again
for i, v in pairs(Players:GetChildren()) do
ClientSet:FireClient(v)
end
end)
Here is the receiving function for the ClientSet remote event:
StartingTrigger.OnClientEvent:Connect(function() --When remote event is called, enact the HomeScreenFunction (same for below)
HomeScreenfunction()
end)
Here’s the player added function
ReadyToCon.OnServerEvent:Connect(function() --Activate Gui homescreen again
for i, v in pairs(Players:GetChildren()) do
ClientSet:FireClient(v)
end
end)
Summary: When a player is added, the clientset remote event is fired. The client then connects the homescreen function to it, and then, later, the client tells the server to “continue”, in which the server goes and fires the clientset remote event AGAIN.
Now here’s the problem. Whenever the remote event is called the FIRST time, everything works just fine. But the SECOND time the remote event is called, the print function that says “Play Button is hovered over” is called TWICE, even if I hovered into it just once. However, the print function that says “GUI function” is only enacted once each time, like it should be. Here’s a video better explaining the problem.
I have a feeling this has to do with disconnecting and connecting remote events, but I have no idea how to implement that. Sorry if this wasn’t explained very well.