RemoteEvent needs to be in ReplicatedStorage.
And Server Script needs to be in ServerScriptService.
Read the whole topic please, I already explained what i did.
I see but from what I see you are getting the event in the client somehow can you explain it?
No, I fire the event from the client, but when it goes to the serverscript it does not print what it’s meant to print
Yea but you need to have one Event located in ReplicatedStorage.
And fire the event from ReplicatedStorage from Client.
I already tried putting the remote event in replicated storage and putting the serverscript in serverscriptservice, it did not work and i double checked it.
I’m not sure, but I think you need to define the player argument in OnServerEvent
Nope, still does not work, I can’t figure out the problem
Can you show us a screenshot of the explorer?
Try this
Put RemoteEvent with name RemoteEvent in ReplicatedStorage.
Client Code:
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local ButtonToClick = script.Parent
ButtonToClick.MouseButton1Click:Connect(function()
Event:FireServer("Close!")
end)
Server Side Code:
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event.OnServerEvent:Connect(function(player,msg)
print(player.Name.. " sent to server "..tostring(msg))
end)
It should work, btw missing " after "ReplicatedStorage
Oh yeah sorry I wrote it quickly.
“script.Parent” in the server script is ServerScriptService, not ReplicatedStorage. So I’m pretty sure you should get an error/warning here.
Can we have more context? Location of scripts? Errors?
No i did change up the code later on, i just put it back on normal again.
Can you try what I wrote for you?
Yes this worked, tysm, I been struggling with this for the past 40 minutes.
Also, slightly unrelated. But for the sake of future debugging in your development, maybe consider naming your GUI elements something meaningful. It helps everyone involved. Have a good day.
No problem glad that I helped if you want to know more about RemoteEvents/Functions @CovertCode made great video about it.
Watch it here: