Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Server not picking up my :fireserver()?

Asked by 7 years ago

I have a GUI where the player presses start then it should fire a request to the server to set gamerunning to true But if i check the output the clients print does something but the server isn't printing that it recieved it and not setting gamerunning to true.

ServerSide

01local seat = script.Parent
02local camera = game.Workspace.CurrentCamera
03local alreadysend = false
04 
05while true do
06if script.Parent.Occupant ~= nil then
07    if alreadysend == false then
08local char = script.Parent.Occupant.Parent.Name
09local plr = game.Players:FindFirstChild(char)
10game.ReplicatedStorage.CameraEvent:FireClient(plr)
11alreadysend = true
12end
13end
14if script.Parent.Occupant == nil then
15    alreadysend = false
View all 26 lines...

Clientside

01game.ReplicatedStorage.CameraEvent.OnClientEvent:connect(function()
02local frame = script.Parent.Frame
03frame.Visible = true
04frame.TextButton.MouseButton1Click:connect(function(plr)
05    game.ReplicatedStorage.StartGame:FireServer()
06    print('server fired')
07    frame.Visible = false
08    script.Parent.Timermoneyworth.Visible = true   
09    local cam = game.Workspace.CurrentCamera
10    print('clienteventcam')
11    cam.CameraType = 'Attach'
12    cam.CameraSubject = game.Workspace.Minigameplanet.Galaxy.campart
13    game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0
14    wait(1)
15    script.Parent.Parent.sounds.LocalScript.Disabled = true
View all 34 lines...

If anybody could tell why my script isn't working it would be appriciated.

1 answer

Log in to vote
0
Answered by 7 years ago

You have an infinite loop at line 5 in serverside, which is why line 21 is never reached, and the event is not connected.

0
Thanks I managed to fix it. Timmerman73 85 — 7y
Ad

Answer this question