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

Infinite Yield On RBLX Servers But Not In Studio?

Asked by 5 years ago
Edited 5 years ago

As with everything i do in some way something goes wrong so i need some help to continue progress in my game.

If i take out the WaitForChild then it gives me an error on line 2 but doesn't happen in studio ( The Error Was Saying That The ModeHandler Didn't Exist )

I Know For A Fact I Have Not Done Any Typos

This is the code i used

Main = game:GetService("Players").LocalPlayer
MP = game:GetService("ServerScriptService"):WaitForChild("ModeHandler")

game.Workspace.NumberPlayers.Changed:connect(function()
    wait(0.5)
    if game.Workspace.NumberPlayers.Value >= 1 then
        Main.PlayerGui.ModePickGUI.RoundShadow.DropShadow.Namez.Text = "?????"
        MP.Disabled = false
        wait(8)
        game:GetService('SoundService').DrumRoll:Play()
        Main.PlayerGui.ModePickGUI.RoundShadow:TweenPosition(UDim2.new(0.314,0,0.343,0))
        wait(2.5)
        Main.PlayerGui.ModePickGUI.RoundShadow.DropShadow.Namez.Text = game:GetService("ServerStorage").Mode.Value
        wait(3)
        Main.PlayerGui.ModePickGUI.RoundShadow:TweenPosition(UDim2.new(0.314,0,-1.343,0))
        script.Disabled = true
    end
end)
2
is it a LocalScript? Cause you can't access ServerScriptService or ServerStorage in a LocalScript SirDerpyHerp 262 — 5y
0
Oh well I didn’t know that. Yes your right put it as an answer and I’ll give you the reward GizmoProductions 61 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

at the begining of your script type this:

repeat wait() until game.Players.LocalPlayer
repeat wait()until game.Players.LocalPlayer.Character

then the rest of your script can follow after the two blocks of code

hope it works

Ad

Answer this question