https://gyazo.com/28d8d7b50d0681ca351286a6e253303d script.Parent.Touched:Connect(function() game.ReplicatedStorage.Stage1Check:FireServer() end)
FireServer
cannot be fired from a Script
. However, it can be fired from a LocalScript
.
To check if your script is a Script
, click on it and view the properties. Look at the ClassName
.
If the ClassName
is "Script
", then make sure to create a new LocalScript
and put it there instead.
To be clear, LocalScript
s run on the client (the player's computer), and Script
s run on the server.
For future reference, the following can be done on the server:
FireClient
for RemoteEvent
from a Script
InvokeClient
for RemoteFunction
from a Script
OnServerEvent
for RemoteEvent
from a Script
OnServerInvoke
for RemoteFunction
from a Script
FireAllClients
for RemoteEvent
from a Script
The following can be done on the client:
FireServer
for RemoteEvent
from a LocalScript
InvokeServer
for RemoteFunction
from a LocalScript
OnClientEvent
for RemoteEvent
from a LocalScript
OnClientInvoke
for RemoteFunction
from a LocalScript
Here's the deal:
The action Fire Server
cannot be called from a server script as you must know.
The reason this doesn't work is that Server Scripts
are on the server side. Anything on the server-side doesn't need an event! So you do NOT need to fire an event from a regular script. Whenever an action happens from a server script, it automatically replicates to everyone else. On the other hand with a local script, it only replicates to the client. That's the reason it won't work.
Your code is simple to fix. I once thought the same thing but then I learned that you don't need to set up an event for actions used in server scripts.
So overall, all you need to do is move the code. I hope this makes sense. If it doesn't, I will explain:
So first of all, think about it. You're firing an event from a server script then, whenever it's fired, a server script(the same type of script that fired it) receives it. So it wouldn't make sense to have to fire an event from one context level then receive it from the same.