Hiaa guys. Sorry again sorry for all the questions ;). Quick quesion here, about Vector3 and CFrame values. I want to know how to convert a value from CFrame to Vector3 and vice - versa. Here's an example:
wait(2) blue = game.Workspace.BlueSpawn red = game.Workspace.RedSpawn Var = 0 players = game.Players:GetChildren() function SpwnTele() print(player.Value.Value) if player.Value.Value=="blue" then player.Character.Torso.CFrame = CFrame.new(Vector3.new(blue.Position)) --heres the line I need help with print(player.Character.Torso.CFrame) else player.Character.Torso.CFrame = CFrame.new(Vector3.new(red.Position)) --and this one too print(player.Character.Torso.CFrame) end end for i,v in pairs(players) do if Vteam==nil then player = v Vteam = Instance.new("StringValue") Vteam.Parent = v Var = math.random(1,2) if Var==1 then Vteam.Value = "red" SpwnTele() elseif Var==2 then Vteam.Value = "blue" SpwnTele() end end end
Sorry if the script is a bit long. If you find a errors within the script, speak up! (BTW the script is supposed to create a string value for each player then pick a random team color, from which the player will be teleported to the corresponding Part with that color.) THX!!
CFrame values have two Vector3 values in it:
1) The position the part is positioned at
2) The position that the part is facing
To get the position:
local pos = part.CFrame.p
To get where it is facing:
local pos = part.CFrame.LookVector -- or, if you want individual numbers local posX, posY, posZ = part.CFrame.X, part.CFrame.Y, part.CFrame.Z