First of all, fix your formatting. Indent each line appropriately, because it could get confusing to look at.
repeat
wait(1)
if workspace:findFirstChild("Player") then
if script.Parent.Value == 1 and script.Parent.Parent.CamValue.Value == 1 then
workspace.Player.Torso.CFrame = CFrame.new(workspace.Spawners.WhiteSpawn.Position + Vector3.new(0, 2, 0))
elseif script.Parent.Value == 2 and script.Parent.Parent.CamValue.Value == 1 then
workspace.Player.Torso.CFrame = CFrame.new(workspace.Spawners.GraySpawn.Position + Vector3.new(0, 2, 0))
elseif script.Parent.Value == 3 and script.Parent.Parent.CamValue.Value == 1 then
workspace.Player.Torso.CFrame = CFrame.new(workspace.Spawners.BlackSpawn.Position + Vector3.new(0, 2, 0))
end
end
until script.Parent.Parent.CamValue.Value == 0
Let's make some variables to assess the situation more efficiently.
CamValue = script.Parent.Parent:WaitForChild("CamValue")
SomeRandomValue = script.Parent
WhiteSpawnPos = workspace.Spawners.WhiteSpawn.Position
GraySpawnPos = workspace.Spawners.GraySpawn.Position
BlackSpawnPos = workspace.Spawners.WhiteSpawn.Position
repeat
wait(1)
if workspace:findFirstChild("Player") then
if SomeRandomValue.Value == 1 and CamValue.Value == 1 then
workspace.Player.Torso.CFrame = CFrame.new(WhiteSpawnPos + Vector3.new(0, 2, 0))
elseif SomeRandomValue.Value == 2 and CamValue.Value == 1 then
workspace.Player.Torso.CFrame = CFrame.new(GraySpawnPos + Vector3.new(0, 2, 0))
elseif SomeRandomValue.Value == 3 and CamValue.Value == 1 then
workspace.Player.Torso.CFrame = CFrame.new(BlackSpawnPos + Vector3.new(0, 2, 0))
end
end
until CamValue.Value == 0
The main problem I see with this script is on line 5, if there's "Player" in the workspace. Now, I'm pretty sure your user name is "yogipanda123", not "Player".
"Player" is the name of the testing player spawned in solo mode. If you want the script to work in the server, refer each player as its own with...
game.Players.LocalPlayer
(Note: LocalPlayer can only be mentioned in Local Scripts.)
repeat
wait(.1)
until game.Players.LocalPlayer
PLR = game.Players.LocalPlayer
CHAR = PLR.Character
if not CHAR then
CHAR = PLR.CharacterAdded:wait(.1)
end
Torso = CHAR:WaitForChild("Torso")
Now, let's continue on to your "repeat" loop.
repeat
wait(1)
if SomeRandomValue.Value == 1 and CamValue.Value == 1 then
Torso.CFrame = CFrame.new(WhiteSpawnPos + Vector3.new(0, 2, 0))
elseif SomeRandomValue.Value == 2 and CamValue.Value == 1 then
Torso.CFrame = CFrame.new(GraySpawnPos + Vector3.new(0, 2, 0))
elseif SomeRandomValue.Value == 3 and CamValue.Value == 1 then
Torso.CFrame = CFrame.new(BlackSpawnPos + Vector3.new(0, 2, 0))
end
until CamValue.Value == 0
This should be a working script. Place this in StarterGui and test it out. I would love to mention other ways to make this, but to do that I would have to know the whole script(s), the purpose of SomeRandomValue, and how will the value of CamValue reach 0.
3 comments
The side script does, but this exact script doesn't it just moves the player as soon as script.Parent.Value == 1 and CamValue == 1
What do you mean by "except in Roblox Player itself" and "The side script does"?
Try and rewrite your revised script here.