Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a part welded to a player move where your camera is moving?

So I have code that when you click a part it creates a part and welds it to you:

script.Parent.MouseClick:Connect(function(player)

local wel = Instance.new("Weld", workspace)

local part = Instance.new("Part", workspace)

local prt = game.ReplicatedStorage.lemon:Clone()

prt.Parent = workspace

part.Transparency = 1

part.CanCollide = false

prt.CanCollide = true

prt.Position = game.workspace.grass.Part.Position

part.CanCollide = false

part.Transparency = 0

print("worksed")

wel.Part0 = part

part.Transparency = 1

wel.Part1 = player.Character.LowerTorso

wel.Parent = player.Character.LowerTorso

wel.C0 = CFrame.new(0.46,-0.8,1)

local rocpro = Instance.new("RocketPropulsion",prt)

rocpro.Target = part

rocpro.MaxSpeed = 40

  

prt.CanCollide = true

rocpro:Fire()

wait(3)

rocpro:Abort()

local wel2 = Instance.new("Weld",workspace)

wel.Part0 = prt

wel.Part1 = player.Character.LowerTorso

wel.C0 = CFrame.new(0.46,-0.8,1)

end)

How would I make it so it is always where your camera is moving???

When I look down, the object is not facing the same.

Does anyone know how to do this??

1 comment

0

you can probably just get a loop that sets the cframe of the object to the cframe of the camera

2 answers

✓ Accepted answer

You would need to get the camera position then divide it by .5, then add an endless loop to your part thats welded that changes the Y value by camera position/.5

This discussion is preserved as it was. New answers, comments, and votes are closed.