Works in studio, not in play
I'm trying to get it so it will send the text and it can receive it, but I'm extremely lost and keep getting the error: 'OnServerEvent can only be used on the server line 7'
Everything I try just leads to an error
--sendr script.Parent.EditFrame.Enter.MouseButton1Down:connect(function() game.Workspace.DisplayManger.Sender:FireServer(script.Parent.EditFrame.TextBox.Text) end) --recivr game.Workspace.DisplayManger.Sender.OnServerEvent:connect(function(player, text) script.Parent.TextLabel.Text = "The party is at: "..text end)
Make sure the script calling :FireServer() is a localscript and the script getting the .OnServerEvent is a serverscript.
-- Localscript repeat game:GetService'RunService'.RenderStepped:wait() until game.Players.LocalPlayer local player = game.Players.LocalPlayer local gui = script.Parent gui.EditFrame.Enter.MouseButton1Down:connect(function() game:GetService'Workspace':WaitForChild'DisplayManger'.Sender:FireServer(gui.EditFrame.Text) end) -- ServerScript game:GetService'Workspace'.DisplayManger.Sender.OnServerEvent:connect(function(player,text) script.Parent.TextLabel.Text = "The party is at: "..text end)