As you can see from the title, I’m trying to make a part spawn in front of a player (and it’s going to be welded to the player so it moves with them) and I have a sort of functional script except it doesn’t rotate to the player’s rotation it starts to mess up weirdly when i try to modify it with Vector3.new or CFrame.new, all help would be appreciated.
here’s my code:
local replicatedStorage = game:GetService("ReplicatedStorage")
replicatedStorage.WandaRemotes.WandaShield.OnServerEvent:Connect(function(player)
local character = player.Character
local shield = replicatedStorage.WandaPowers.WandaShield:Clone()
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = shield
weldConstraint.Part1 = character.HumanoidRootPart
weldConstraint.Parent = shield
shield.Position = character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector
shield.Parent = workspace
end)
Maybe don’t use CFrame.LookVector. One thing to note is that a part’s front surface is always the negative Z direction (-Z), so you can do this instead:
^ Is a really good comment, however it’s not going to be relative to the characters orientation, To do this you’re going to need to utilise CFrames. (Just to orientate it!) https://gyazo.com/45cfa5f21b5b00e33e02288073fba1c4
yeah; CFrame contains ALOT of information covering a series of things such as look, orientation and position. You can learn much more about it here, Roblox made an awesome tutorial for it!