Uh... i can't really know what should i say more than "Hey, this script is broken, it works perfectly on studio but not on the online game."
The script that i'm talking about is:
Door = script.Parent ClickDetector = script.Parent.ClickDetector despacito = true Footsteps = script.Parent.Footsteps game.Players.PlayerAdded:connect(function(Clicker) Persin = Clicker.PlayerGui:WaitForChild("BlackScreen") Frame = Persin:WaitForChild("Frame") Char = Clicker.Character Root = Char:WaitForChild("HumanoidRootPart") ClickDetector.MouseClick:connect(function(Clicker) if despacito == true then despacito = false Frame.Transparency = 0.9 wait(0.03) Frame.Transparency = 0.7 wait(0.03) Frame.Transparency = 0.5 Footsteps:Play() wait(0.03) Frame.Transparency = 0.3 wait(0.03) Frame.Transparency = 0.1 wait(0.03) Frame.Transparency = 0 Root.CFrame = CFrame.new(Vector3.new(-137.187, 3.87, -62.108)) wait(1) Frame.Transparency = 0.1 wait(0.03) Frame.Transparency = 0.3 wait(0.03) Footsteps:Stop() Frame.Transparency = 0.5 wait(0.03) Frame.Transparency = 0.7 wait(0.03) Frame.Transparency = 0.9 wait(0.03) Frame.Transparency = 1 despacito = true end end) end)
The problem apparently comes from being a "infinite field" on waitforchild("BlackScreen")
Even tough I made this script, meaning I have a basic grasp on scripting, but I don't understand what a "infinite field" means, maybe if you guys tell me what it is, I can fix it.
If you wonder what "blackscreen" is, it's just a GUI to make the screen fade to black.
Ok, so the way testing in Roblox Studio Editor is that it acts as both the client and the server, so it's not going to always give you the same results when you test in the actual game, as a client.
First off, the "Infinite Yield" error is something you shouldn't be worrying about; if it is bothering you then you can just add a random time limit after the object you are waiting for:
Clicker.PlayerGui:WaitForChild("BlackScreen", 1000)
Char:WaitForChild("HumanoidRootPart", 1000)
For your script to work in an actual game, you'll need to learn how to about FilteringEnabled and how to use RemoteEvents.
In your script you are trying to change the children under the "PlayerGui" of a player (You're trying to change the frame, the "BlackScreen").
Clicker.PlayerGui:WaitForChild("BlackScreen")
Since this is a server script, and not a client/local script, we can't actually access those properties of a player, they are private only to the player.
This means we would have to go "local", and the only way to do that is to use something called a RemoteEvent. I'm not going to explain it all to you though, you're going to have to learn it on your own.
Other Errors in Your Code
When defining variables in functions inside your script, such as your "Persin" variable, you need to add a "local" in front of it, which means it can only be accessed in that function.
Also, if you're going to add a RemoteEvent, you don't need the PlayerAdded part, it's useless because we already got the player from the ClickDetector.
Sorry if I sound a bit disheartening, but you'll need to do a bit more research, and I can't help you with that. I hope I helped you though, the fading part of the script sounds pretty cool!
If your teleporting players then...
local player = game.Players.LocalPlayer local TelePart = game.Workspace.InsertPartHere.Position player.Character.HumanoidRootPart.CFrame = CFrame.new(TelePart)
Idk if it will work????