Hello!
I’m trying to make a remote event work.
But, when I tried scripting it doesn’t work and tells me that a Remote Event can only be fired from the Client.
I have tried searching it on developer.roblox.com, but I could not find anything.
So what I’m trying to make is that when a part is clicked (clickdetector) something will happen.
-- Code in part where the remote event is going to be fired (script)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local click = script.Parent.ClickDetector
local meetingevent = ReplicatedStorage:WaitForChild("MeetingEvent")
click.MouseClick:Connect(function(player)
meetingevent:FireServer()
end)
-- Code in ServerScriptService, where the script is listening for the RemoteEvent. (script, not localscript)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("MeetingEvent")
local function onCreateMeeting(player)
print(player.Name .. "called a meeting")
end
remoteEvent.OnServerEvent:Connect(onCreateMeeting)
Thanks for reading ![]()