So I want it when the part spawns in, it's directly in front of the player. I have this:
The script is inside of the PlayerGui which is inside of game.Players.Player
torso = game.Workspace:FindFirstChild(script.Parent.Parent.Name).Torso
detector = game.Lighting.EarthDetector:Clone()
if script.Parent.Parent.TeamColor == game.Teams["Earth Team"].TeamColor then
detector.Parent = game.Workspace
detector:MoveTo(torso.Position+Vector3.new(0,0,-10))
if detector:GetModelCFrame().y > torso.CFrame.y + 2 then
torso.CFrame = detector.EarthDetector.CFrame
wait(2)
detector.Parent = game.Lighting
end
end
Now the issue is, when the part spawns in it spawn in always in one direction from the player, like always one one side of the player. Relative to the player's position, but not the player's angle.
For instance, if I'm looking forward, it will spawn to the left. If I'm looking left, it will spawn to the left. If I'm looking back, it will spawn to the left. It always spawns in the exact same spot relative to the player's position, so if I turn but not move the block will stay in place. Does anyone see the issue here? |