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

Problems with LookVector when I set a part's velocity to it?

Asked by 4 years ago
Edited 4 years ago

I'm making a script where if the player presses a key it would fire a shot from it's head. It does execute the script however it does not go in the player's direction and whenever I jump I get flung off.

(I know this script is causing the problem since I disabled this one for testing and I didn't get flung)

Here is my script:

elseif input.KeyCode == Enum.KeyCode.B and playerTeam == game.Teams.Zombies then
    local bloat = Instance.new("Part")
    bloat.Shape = ("Ball")

    bloat.Parent = character:WaitForChild("HumanoidRootPart")
    bloat.Velocity = character.HumanoidRootPart.CFrame.LookVector * 100 
    print(bloat.Position)  --prints (0, 0, 0) everytime
end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

u might have to insert a VectorForce + the bloat.Shape = Enum.PartType.Ball then u need to do in the vectorforce: create a new attachment, set it to attachment0 then do:

Attachment.Position = Ball.Position

attachment1 has to be the players humanoidrootpart so:

OtherAttach.Position = game.Players.LocalPlayer.Character.Head.Position
0
What do you mean by "VectorForce + bloat.Shape = Enum.PartType.Ball" ? 123nabilben123 499 — 4y
0
the bloat.Shape should be Enum.PartType.Ball (sorry) :P User#29913 36 — 4y
0
What would my script be after your changes I can't wrap my head around it.. I am currently looking at the wiki for what attachments are. 123nabilben123 499 — 4y
0
I just found out my spheres are appearing at 0, 0, -5 so I teleported my player there. It somewhat worked since it was firing the direction my rootpart was facing cause of the lookVector but it is not firing near my torso's position. 123nabilben123 499 — 4y
View all comments (2 more)
0
ill change it User#29913 36 — 4y
0
Also if I’m making it do damage should I make a ‘cloning script’ and put it under the “sphere” or should I handle damage on the script that shoots it? 123nabilben123 499 — 4y
Ad

Answer this question