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 6 years ago
Edited 6 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

01Main = game:GetService("Players").LocalPlayer
02MP = game:GetService("ServerScriptService"):WaitForChild("ModeHandler")
03 
04game.Workspace.NumberPlayers.Changed:connect(function()
05    wait(0.5)
06    if game.Workspace.NumberPlayers.Value >= 1 then
07        Main.PlayerGui.ModePickGUI.RoundShadow.DropShadow.Namez.Text = "?????"
08        MP.Disabled = false
09        wait(8)
10        game:GetService('SoundService').DrumRoll:Play()
11        Main.PlayerGui.ModePickGUI.RoundShadow:TweenPosition(UDim2.new(0.314,0,0.343,0))
12        wait(2.5)
13        Main.PlayerGui.ModePickGUI.RoundShadow.DropShadow.Namez.Text = game:GetService("ServerStorage").Mode.Value
14        wait(3)
15        Main.PlayerGui.ModePickGUI.RoundShadow:TweenPosition(UDim2.new(0.314,0,-1.343,0))
16        script.Disabled = true
17    end
18end)
2
is it a LocalScript? Cause you can't access ServerScriptService or ServerStorage in a LocalScript SirDerpyHerp 262 — 6y
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 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

at the begining of your script type this:

1repeat wait() until game.Players.LocalPlayer
2repeat 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