Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago
Edited 5 years ago

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??

0
you can probably just get a loop that sets the cframe of the object to the cframe of the camera wwwdanielwww 5 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

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

Ad
Log in to vote
1
Answered by 4 years ago

Ok thanl you

Answer this question