script.Parent.MouseButton1Click:Connect(function() local targetteamarea = game.Workspace.CurrentMap:FindFirstChild("RedTeamSpawnArea") if targetteamarea == nil then return end if targetteamarea ~= nil then local teamfolder = game.Teams local teamname = teamfolder:FindFirstChild("Red") if teamname == nil then print("no team found") end if teamname ~= nil then local plr = game.Players.LocalPlayer local char = plr.Character local teamspawn = targetteamarea:WaitForChild("RedSpawn",10) plr.Team = teamname char.HumanoidRootPart.CFrame = CFrame.new(teamspawn.Position) script.Parent.Parent.Parent.Parent.Enabled = false end end end)
Im trying to set the players CFrame to a spawner inside a model using a localscript, but the model is far away and it wont finish loading no matter how long I wait. I tried using findfirstchild, and I tried waitforchild, I even tried extending waitforchild by adding a timeout but nothing works. unless I physically move the object to the player it wont load. is there maybe a way for me to preload areas or another way to find an object locally