Naming notes: ROBLOX prefer workspace (lowercase) and FindFirstChild (uppercase)
First of all, tab your code correctly. The next remark is that script.Parent.Parent.CamValue.Value == 1 is repeated in every condition, so you should probably just wrap the whole thing in an if.
repeat
wait(1)
if workspace:FindFirstChild("Player") and script.Parent.Parent.CamValue.Value == 1 then
if script.Parent.Value == 1 then
script.Parent.Parent.MechName.Text = "Forest Camo Mech single gun"
workspace.CurrentCamera.CameraSubject = workspace.CameraFocus1
workspace.CurrentCamera.CameraType = "Attach"
wait(0.75)
workspace.Player.Torso.CFrame = (CFrame.new(workspace.Map.Spawners.WhiteSpawn.Position + CFrame.new(0, 2, 0)))
elseif script.Parent.Value == 2 then
script.Parent.Parent.MechName.Text = "Forest Camo Mech double guns"
workspace.CurrentCamera.CameraSubject = workspace.CameraFocus2
wait(0.75)
workspace.Player.Torso.CFrame = (CFrame.new(workspace.Map.Spawners.GraySpawn.Position + CFrame.new(0, 2, 0)))
elseif script.Parent.Value == 3 then
script.Parent.Parent.MechName.Text = "Forest Camo Mech double guns w/ cannon"
workspace.CurrentCamera.CameraSubject = workspace.CameraFocus3
wait(0.75)
workspace.Player.Torso.CFrame = (CFrame.new(workspace.Map.Spawners.BlackSpawn.Position + CFrame.new(0, 2, 0)))
end
end
until script.Parent.Parent.CamValue.Value == 0
As to the actual problem:
You cannot do Vector3 + CFrame; .Position is a Vector3 and CFrame.new makes a CFrame.
The solution would be to flip them; but I would argue it makes more sense to use
workspace.Player.Torso.CFrame = workspace.Map.Spawners.BlackSpawn.CFrame + Vector3.new(0, 2, 0)
These lines of code are very long. You should probably make variables to clean it up. For instance...
repeat
wait(1)
if workspace:FindFirstChild("Player") and script.Parent.Parent.CamValue.Value == 1 then
local spot
local focus
local message
workspace.CurrentCamera.CameraType = "Attach"
if script.Parent.Value == 1 then
text = "Forest Camo Mech single gun"
focus = workspace.CameraFocus1
spot = workspace.Map.Spawners.WhiteSpawn
elseif script.Parent.Value == 2 then
text = "Forest Camo Mech double guns"
focus = workspace.CameraFocus2
spot = workspace.Map.Spawners.GraySpawn
elseif script.Parent.Value == 3 then
text = "Forest Camo Mech double guns w/ cannon"
focus = workspace.CameraFocus3
spot = workspace.Map.Spawners.BlackSpawn
end
script.Parent.Parent.MechName.Text = text
workspace.CurrentCamera.CameraSubject = focus
wait(0.75)
workspace.Player.Torso.CFrame = spot.CFrame + Vector3.new(0, 2, 0)
end
until script.Parent.Parent.CamValue.Value == 0
Note that if you're using CamValue only at 0 and 1, you should just use BoolValue instead.
6 comments
I lost a point? Seriously? Why?
Don't move your Humanoid. Rather, move the Torso using CFrame; or the model using :MoveTo() or :SetPrimaryPartCFrame()
If i move the torso will the rest of the player go with it?
If you use CFrame, yes. If you use Position, it will only move the torso and will kill the player.
K, thank you, another problem was i was adding CFrames, not Vector3s
@yogi I think you lost a point because your original title was bad.