Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Infinite Yield On RBLX Servers But Not In Studio?

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 comments

2

is it a LocalScript? Cause you can't access ServerScriptService or ServerStorage in a LocalScript

0

Oh well I didn’t know that. Yes your right put it as an answer and I’ll give you the reward

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.