I want to create this shield that always appears in front of the player's torso, but I don't know how to always make it go a few studs away from the front of the player's torso.
Here's what I got :
local plr = script.Parent.Parent.Parent local char = plr.Character or plr.CharacterAdded:Wait() local p = Instance.new("Part",game.Workspace) active = false script.Parent.MouseButton1Click:Connect(function() if char and not active then local torso = char:WaitForChild("Torso") active = true p.Position = Vector3.new(torso.Position.X + 5,torso.Position.Y,torso.Position.Z) p.Anchored = true p.Size = Vector3.new(5,10,1) p.Transparency = .7 p.Material = Enum.Material.Neon wait(10) p:Destroy() wait(12) active = false end end)
Each part has a CFrame value. Basically accounts for both position and orientation from the part's perspective. CFrame is better for putting parts in front of your torso because it's not based on world space. So if you use a position and orientation combo, you will end up with something messy because both properties don't know where the front of your torso is.
local part = Instance.new('Part',workspace) local torso = workspace.chloe_price65.Torso -- Assuming we are in r6 part.CFrame = torso.CFrame * --Goes to torso's position and -- orientates to torso's orientation. CFrame.new(0,0,5) -- Because we are in the torso's persective, you can sort of treat it as a vector3 value.