|
| 04 Nov 2017 07:18 AM |
It works in play mode, but not server mode. I tested the script, the script fires the event properly, but the receive just somehow doesn't receive it in server mode. Here is the code of the function.
local SpawnEvent = game.ReplicatedStorage:WaitForChild("SpawnHyperloop") function spawnHyperloop(name)
end SpawnEvent.OnServerEvent:connect(spawnHyperloop)
|
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 07:19 AM |
| This is a script in the workspace btw |
|
|
| Report Abuse |
|
|
| |
|
Kiriot22
|
  |
| Joined: 19 Jul 2015 |
| Total Posts: 226 |
|
|
| 04 Nov 2017 07:51 AM |
| And what is the localscript? |
|
|
| Report Abuse |
|
|
mattscy
|
  |
| Joined: 06 May 2011 |
| Total Posts: 1079 |
|
|
| 04 Nov 2017 07:53 AM |
are you creating the remote event with the local script?
if you are and fe is on then your server wont see the event after its created
just use an already existing one, or create the remote event with the server script
|
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 08:07 AM |
| @mattscy - The remote event is stored in Replicated storage |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 08:09 AM |
@Kiriot - Here is what was in the local script. The local script is part of player gui.
local SpawnHyperloop = game.ReplicatedStorage:WaitForChild("SpawnHyperloop")
function click() SpawnHyperloop:FireServer() end script.Parent.MouseButton1Click:connect(click) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 04 Nov 2017 08:35 AM |
| Try using prints in various spots in both scripts |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 08:38 AM |
| ^ Yes I did and I figured out that the event fires properly, but the listener doesn't listen. That is why I included the listener's script at the top |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 08:39 AM |
| Are you sending a name argument? |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 08:42 AM |
| ^ What do you mean by name argument? |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 08:43 AM |
| Btw I don't think the problem is the code itself, I placed the listener in the WorkSpace and I think that is the reason it doesn't work. However, how do I make a listener work in Workspace? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 04 Nov 2017 11:14 AM |
| Cmon guys this shouldn't be a hard problem to fix..... |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 11:16 AM |
| It works in normal play-mode just not server mode. That means the code is probably correct |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 11:21 AM |
Here is the whole code in one piece. The 1st piece is an ordinary script placed in ServerScriptService. The function doesn't run... The 2nd piece of code is a Local Script that fires the remote event. It works
game.ReplicatedStorage:WaitForChild("SpawnHyperloop1").OnServerEvent:connect(function(player) print("EVENT LISTENED") local a = game.ServerStorage.ET31:Clone() print("CLONED") a.Parent=game.Workspace end)
local SpawnHyperloop = game.ReplicatedStorage:WaitForChild("SpawnHyperloop1") function click() SpawnHyperloop:FireServer() print("FIRED") end script.Parent.MouseButton1Click:connect(click) |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Nov 2017 11:27 AM |
| Seriously guys? No one know what the problem is?! |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2017 11:33 AM |
| I thought there are supposed to be lots of knowledgeable people in the Scripter forum. And no can find the problem to a freaking 20 line remote event code?! |
|
|
| Report Abuse |
|
|
7263
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 87 |
|
|
| 04 Nov 2017 11:33 AM |
Well, the problem does not seem very clear, however, you are passing the Player object to the function "spawnHyperloop(name)" as "name" since the return for "OnServerEvent" is "Player, Arguments".
Other than that I do not see what the problem could be, maybe you are getting errors in output that might help? |
|
|
| Report Abuse |
|
|