Hello! So I have a problem, and when I fire a remote event the server isn’t picking it up.
What do you want to achieve? When the GUI button is clicked, BarnDoors should hide
What is the issue? The Server isn’t picking up the remote event. It worked before, but since my Roblox Studio Updated about 1 week ago it broke.
What solutions have you tried so far? I have tried using prints and the server still won’t pick it up! (I have read about remote events on the Wiki, and it still doesn’t work)
The Clicking of the GUI button, is just for testing purposes.
(Here is the local script for my GUIs, which fires the RemoteEvent)
local Test = script.Parent.Test
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DisableObject = ReplicatedStorage:FindFirstChild("DisableObject")
script.Parent:WaitForChild("Test").MouseButton1Click:Connect(function()
DisableObject:FireServer()
print("Fired Server!")
end)
(This is in a script in ServerScriptService, (I have not put the barnDoor things in yet! I am just trying to get it to pick it up!)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local barnDoor = game.Workspace.Maps.FarmMap.BarnDoor
local barnDoor2 = game.Workspace.Maps.FarmMap.BarnDoor2
local DisableObject = game.ReplicatedStorage:FindFirstChild("DisableObject")
DisableObject.OnServerEvent:Connect(function()
print("Remote Event Picked up")
end)
All The output says is, when I click the button is “Fired Server!” There isn’t any “Remote Event Picked up” in the output. And there is nothing in the Dev Console! about it. And yes the name of the remote event is the Exact same as the one in replicated storage.
On the local script, you’re calling “Test” a string instead of an object. Try changing your script to:
——-
local Test = script.Parent.Test
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local DisableObject = ReplicatedStorage:FindFirstChild(“DisableObject”)
script.Parent:WaitForChild(Test).MouseButton1Click:Connect(function()
DisableObject:FireServer()
print(“Fired Server!”)
end)
——-
(sorry I’m in mobile so Idk how to do the actual block of code)
You said WaitForChild(“Test”) when it should be just (Test)
I Tried, but the sever still doesn’t pickup the remote event. In the output it does say “Fired Server!” But there are no “Remote Event Picked up”
(The ServerScript)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DisableObject = game.ReplicatedStorage:WaitForChild("DisableObject")
DisableObject.OnServerEvent:Connect(function()
print("Remote Event Picked up")
end)
(Local Script in the GUI)
local Test = script.Parent.Test
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DisableObject = ReplicatedStorage:WaitForChild("DisableObject")
script.Parent:WaitForChild("Test").MouseButton1Click:Connect(function()
DisableObject:FireServer()
print("Fired Server!")
end)
Could you try adding a print in your server script after the event binding, just to see if the script is active and the event binding was executed?
e.g:
If that latter print statement didn’t fire, at least one of three problems could be affecting you:
the server script is disabled: just uncheck the .Disabled property.
the server script is not a descendant of the right service: they can only be active in Workspace, ServerScriptService, or ReplicatedScriptService (if you happened to add it to your explorer).
maybe your server script is not a class of Script: if not, you should create a new script and transfer the source code there.
You can read more about Scriptson the dev hub if you need!
I have tried all of those, I even deleted the remote Event and renamed it. I copied and paste the name to make sure it was right. The sever still isn’t picking it up.
Assuming you do not have any errors, and have implemented what others have said, run your game
in Studio and look in ReplicatedStorage in the Explorer and see if you have more than one "DisableObject" RemoteEvent there, as Object names do not need to be unique.
I should also note that your OnServerEvent handler should have a player argument, so you can
tell which player it came from.
This is my script, in ServerScriptService. (I renamed DisableObject to HideObject, to see if it fixes) ignore the barnDoor Variables.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local barnDoor = game.Workspace.Maps.FarmMap.BarnDoor -- The Remote Event Fires This
local barnDoor2 = game.Workspace.Maps.FarmMap.BarnDoor2 -- The Remote Event Fires This
local HideObject = game.ReplicatedStorage:WaitForChild("HideObject")
HideObject.OnServerEvent:Connect(function(player)
print("Fired The Server!")
end)
print("script running, event binded")
This is my local script, in a screenGui. (Which has all my UI in)
local Test = script.Parent.Test
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HideObject = ReplicatedStorage:WaitForChild("HideObject")
script.Parent:WaitForChild("Test").MouseButton1Click:Connect(function()
HideObject:FireServer()
print("Fired Server!")
end)
Are those the complete scripts or is there more above and below?
It looks fine to me–You mention that you are getting the Fired Server–I’ll assume it doesn’t
have an “x200” or whatever number beside it in the output.
A last thing to try: At the end of the Script, as a test, add:
repeat wait(1) until false
Edit:
One last question: Are you creating the RemoteEvent programmatically or did you just add it
it in the Studio Explorer?
Edit2: Typo
The RemoteEvent is already in the game, I am not creating it through scripts. I tried tha, and the sever still isn’t picking it up. Only for the local script, there are some stuff above it.
Are you using Home->Play in Studio to start the game?
Did you check F9->Scripts or ScriptPerformance to see if your Script is still running (using that wait.)
Did you carefully check the Output for errors?