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

Help with BodyPosition (not going in the wished direction)?

Asked by
Elixcore 1337 Moderation Voter
6 years ago
Edited 6 years ago

Hello so I recently tried to make a script that would clone a part in front of u then make it go in the same direction u are facing but I failed and i don't know how to fix it. Part with problem is written in the script with " -- Part with problem" along with explanation

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(chr)
plr.Chatted:connect(function(msg)
if plr.Name == "My username." then 
if msg == "Red" then
    local hi = game.Workspace.AlexTest.boio:Clone()
    hi.Parent = chr
    hi.CFrame = chr.Torso.CFrame * CFrame.new(0,0,-5)
    hi.Orientation = chr.Torso.Orientation - Vector3.new(0,90,0)
    hi.Name = "Red"
    hi.Anchored = false
chr.Humanoid.WalkSpeed = 0
 -- ^ clone the tool, bring it in front of my torso facing the same direction as my torso.

hi.p.Position = Vector3.new(chr.Torso.CFrame * CFrame.new(0,0,-5000)) -- Part with problem.
--https://gyazo.com/bf847c8fdbe6deb1fee00dd9f8e20156 
-- this is what happens.

chr.Humanoid.WalkSpeed = 16

wait(10)
hi:Destroy()

end
end
end)
end)
end)

There are 2 problems.

  1. It's going down but I can't anchor it because it won't move then.
  2. It's not moving in the direction my torso is facing.
0
`hi.p.CFrame = CFrame`? TheeDeathCaster 2368 — 6y
0
p is a BodyPosition so it doesn't have a CFrame, sorry i forgot to specify. Elixcore 1337 — 6y

Answer this question