I have this script in a player's Gui. When I test it in a localserver (Studio) the remoteevent shows in the player. But when I test it in an online server, it says that the remoteevent isn't there.
local Blue = Instance.new("RemoteEvent") Blue.Name = "Blue" Blue.Parent = script.Parent.Parent.Parent Blue.OnServerEvent:connect(function() local c = game.Workspace.CurrentCamera c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid c.CameraType = "Custom" c.FieldOfView = 70 if script:findFirstChild("SkipCutsceneGuiValue") then if script.SkipCutsceneGuiValue.Value ~= nil then script.SkipCutsceneGuiValue.Value:Destroy() end end wait(0.1) script.Parent.Parent.Parent.TeamColor = BrickColor.new("Deep blue") end)
You technically can, but the event would fail to do anything unless it was created by the server. The reason for this is because when using a remote event or function, both the client and server must be able to see the event/function. One of them will be firing/invoking the event/function, and the other will be connecting a function to the event/function. The reason this script doesn't work is because the local script creates the event in the client, and as a result it isn't replicated to the server, so it will do absolutely nothing. A better solution would be to either have a premade RemoteEvent object in the ReplicatedStorage (or any area that both the client and server can access), or to create the RemoteEvent object via script in the server, and have the client wait until the remote event is available.