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 6 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

local seat = script.Parent
local camera = game.Workspace.CurrentCamera
local alreadysend = false

while true do
if script.Parent.Occupant ~= nil then
    if alreadysend == false then
local char = script.Parent.Occupant.Parent.Name
local plr = game.Players:FindFirstChild(char)
game.ReplicatedStorage.CameraEvent:FireClient(plr)
alreadysend = true
end
end
if script.Parent.Occupant == nil then
    alreadysend = false
end
wait(1)

end

game.ReplicatedStorage.StartGame.OnServerEvent:Connect(function()
    print('recived')
    script.Parent.Parent.Parent.gamerunning.Value = true
    wait(60)
    script.Parent.Parent.Parent.gamerunning.Value = false
end)

Clientside



game.ReplicatedStorage.CameraEvent.OnClientEvent:connect(function() local frame = script.Parent.Frame frame.Visible = true frame.TextButton.MouseButton1Click:connect(function(plr) game.ReplicatedStorage.StartGame:FireServer() print('server fired') frame.Visible = false script.Parent.Timermoneyworth.Visible = true local cam = game.Workspace.CurrentCamera print('clienteventcam') cam.CameraType = 'Attach' cam.CameraSubject = game.Workspace.Minigameplanet.Galaxy.campart game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0 wait(1) script.Parent.Parent.sounds.LocalScript.Disabled = true script.Parent.Parent.sounds.s1:Pause() script.Parent.Parent.sounds.s2:Pause() script.Parent.Parent.sounds.s3:Pause() script.Minigamesound:Play() local secleft = 60 local timer = script.Parent.Timermoneyworth.Timer for i = 1,60 do secleft = secleft -1 timer.Text = secleft wait(1) end game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50 game.Players.LocalPlayer.Character.Humanoid.Jump = true script.Parent.Timermoneyworth.Visible = false script.Parent.Parent.sounds.LocalScript.Disabled = false script.Minigamesound:Stop() end) end)

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

1 answer

Log in to vote
0
Answered by 6 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 — 6y
Ad

Answer this question