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

My projectile is facing sideways, how can i turn it?

Asked by 6 years ago
Edited 6 years ago

So i made a projectile script because i am making a throwing kunai knife.

I got it to throw in the direction of my mouse, but the kunai is turned sideways ( it looks kinda funny, but not very effective)

So the problem isnt the kunai flying in the right direction the problem is that I can't figure out how to turn the actual model of the kunai to face forward

here is my local script inside of the tool

player = game.Players.LocalPlayer
tool = script.Parent
throwable = true
mouse = player:GetMouse()

function shoot()
    if throwable == true then
        throwable = false
        local kunai = game.ReplicatedStorage.kunaiProjectile:Clone()
        kunai.Parent = workspace
        kunai.CanCollide = false
        kunai.CFrame = tool.Handle.CFrame
        kunai.CFrame = CFrame.new(kunai.Position, mouse.Hit.p)
        local bv = Instance.new('BodyVelocity', kunai)
        bv.Velocity = kunai.CFrame.lookVector * 230
        bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)      
        wait(.7)
        throwable = true
    end
end

tool.Activated:Connect(shoot)


0
A BodyGyro should do the trick: http://wiki.roblox.com/index.php?title=API:Class/BodyGyro mattscy 3725 — 6y
0
do you have any hints on how i would go about using one? PoePoeCannon 519 — 6y
0
I don't have time to go into a full answer now, but this page has an example: http://wiki.roblox.com/index.php?title=BodyMover#BodyGyro mattscy 3725 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
kunai.Orientation = bv / 230
Ad

Answer this question