local server = Instance.new ("RemoteEvent",) game.Workspace) server.name = "Call" server.OnServerEvent:connect(function(player, arg)) local shutdown = false; local part = Instance.new("Part") part.Parent = game.Workspace ------------------- define its location/ or where its going to be part.name = ("PartRemoteTest") part.Anchored = true part.BrickColor.new ("") part.Material = ("Neon") wait() remote:FireAllClients("Call",1[] repeat wait() until game.Workspace:FindFirstChild("Call") local event = game.Workspace.Call event.OnClientEvent:connect(function(arg1, arg2, arg3) if SomeObject.Changed.connect(function(Property if Property == "Name" then game.Players:GetPlayers()) do print ("arg1, arg, arg3) Player:Kick() shutdown = true end event.OnClientEvent:connect(function(plr) if Shutdown then Plr:Kick() end end) event:InvokeServer("Finished")
Im new with FE scripting so I used the guide within the site to try and learn it
this any better?
local server = Instance.new ("RemoteEvent",) game.workspace) server.name = "Call" server.OnServerEvent:connect(function(player, arg)) local shutdown = false; local part = Instance.new("Part") part.Parent = game.workspace ------------------- define its location/ or where its going to be part.name = ("PartRemoteTest") part.Anchored = true part.BrickColor.new ("Really red") part.Material = ("Neon") wait() remote:FireAllClients("Call",1[] repeat wait() until game.workspace:FindFirstChild("Call") local event = game.workspace.Call event.OnClientEvent:connect(function(arg1, arg2, arg3) if SomeObject.Changed.connect(function(Property) if Property == "Size" then game.players:GetPlayers()) print (arg1, arg, arg3) player:Kick() shutdown = true end event.OnClientEvent:connect(function(plr) if Shutdown then plr:Kick() end end) event:InvokeServer("Finished")
another update
local server = Instance.new ("RemoteEvent",) game.workspace) server.Name = "Call" server.OnServerEvent:connect(function(player, arg)) local shutdown = false; local part = Instance.new("Part") part.Parent = game.workspace ------------------- define its location/ or where its going to be part.Name = ("PartRemoteTest") part.Anchored = true part.BrickColor.new ("Really red") part.Material = ("Neon") wait() server:FireAllClients("Call",1[] repeat wait() until game.workspace:FindFirstChild("Call") local event = game.workspace.Call event.OnClientEvent:connect(function(arg1, arg2, arg3) if SomeObject.Changed.connect(function(Property) if Property == "Size" then game.players:GetPlayers()) print (arg1, arg, arg3) player:Kick() shutdown = true end event.OnClientEvent:connect(function(plr) if Shutdown then plr:Kick() end end) event:InvokeServer("Finished")
Sorry but you still got a few syntax errors to tend with. But to the main event (pun intended), :OnClientEvent() are functions called inside local scripts and :OnServerEvent() are called inside server scripts. FE is designed to make if difficult for the server and client to manipulate what each other are doing. For example, with FE, you can't have a local script do anything major to the server or other players such as creating bricks (unless local brick but only the client that created it can see it and it is owned by the client), kicking players, changing scoreboards, ect. Similarly, you can't have a server script mess with some client held systems such as the player's Gui or anything the client has created. It's like the server is blind to what the client is doing but the client can see what the server is doing but they can't touch anything. Here you are using both client and server calls in the same script so this won't work. However, here is something that might using the same ideas (not going to to much about syntax as long as you see what's going on):
--Server Side Script local client = Instance.new("RemoteEvent", game.Workspace) client.Name = "Call" local server = Instance.new("RemoteEvent", game.Workspace) server.Name = "Response" server.OnServerEvent:connect(function(player, arg) game.Players:Kick(game.Players[arg]) --Not sure if it works like this but eh end) players=game.Players:GetChildren() client:FireClient(game.Players[players[math.random(#players)].Name])
What this server-side script does is it creates a call even and a response even. One for the server and one for the client. It then calls a random player.
--Local Script server=game.Workspace:WaitForChild("Response") client=game.Workspace:WaitForChild("Call") --Wait for the events to load for the client client.OnClientEvent:connect(function() local players=game.Players:GetChildren() server:FireServer(game.Players[players[math.random(#players)].Name]) end)
This local script will choose a random player when it's fired and send the choice to the server. Both of these scripts combined basically has the server ask a random client to choose to kick a random player. Not very efficient but it's an example. A better thing to use for this would be a RemoteFunction. A RemoteFunction is just like a RemoteEvent but it waits for a return from the other side and would make this a whole lot simpler.
--Server side script for RemoteFunction client=Instance.new("RemoteFunction", game.Workspace) client.Name="Kick" players=game.Players:GetChildren() kicked=client:InvokeClient(game.Players[players[math.random(#players)].Name]) game.Players:Kick(game.Players[kicked])
Much Smaller
--Local Script client=game.Workspace:WaitForChild("Kick") players=game.Players:GetChildren() function steve() return(game.Players[players[math.random(#players)].Name]) end client.OnClientInvoke=steve
Even Smaller. Do note that there can be complications with RemoteFunctions such as bandwidth and disconnections
It won't. This is all wrong.
It'll definitly error on line 1, line 2, line 3, line 7, line 9, line 12, line 19, line 21, line 22, line 23, line 29, line 30.