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

Infinite yield possible on 'Players.test.PlayerGui:WaitForChild("muted")'?

local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function() if workspace.Music.IsPlaying == true then script.Parent.Image = "rbxassetid://202000870" workspace.Music:Pause() game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.TextTransparency = 0 game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Visible = true game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Text = "muted!" local tweenservice = game:GetService("TweenService") local tweenInfo = TweenInfo.new( 0.3,Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false ) local tween = tweenservice:Create(game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel, tweenInfo, {Position = UDim2.new(0.5, 0,0.80, 0)}) tween:Play() wait(2) local tweenservice = game:GetService("TweenService") local tweenInfo = TweenInfo.new( 0.3,Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false ) local tweene = tweenservice:Create(game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel, tweenInfo, {TextTransparency = 1}) tweene:Play() tweene.Completed:Connect(function() game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Position = UDim2.new(0.5, 0,0.85, 0) game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Visible = false end) else script.Parent.Image = "rbxassetid://202000937" workspace.Music:Resume() game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.TextTransparency = 0 game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Visible = true game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Text = "unmuted!" local tweenservice = game:GetService("TweenService") local tweenInfo = TweenInfo.new( 0.3,Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false ) local tween = tweenservice:Create(game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel, tweenInfo, {Position = UDim2.new(0.5, 0,0.80, 0)}) tween:Play() wait(2) local tweenservice = game:GetService("TweenService") local tweenInfo = TweenInfo.new( 0.3,Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false ) local tweene = tweenservice:Create(game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel, tweenInfo, {TextTransparency = 1}) tweene:Play() tweene.Completed:Connect(function() game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Position = UDim2.new(0.5, 0,0.85, 0) game.Players.LocalPlayer.PlayerGui:WaitForChild("muted").TextLabel.Visible = false end) end end)

1 answer

Are you sure that when you're referring to "muted" that it's spelt correctly, with capital letters? That error appears when whatever you're trying to yield something that never existed. (I think, im new to scripting, but still trying to help)

Also, when you're going to copy and paste code make sure you use the lua button in the text editing options, so it makes it more clear.

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