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

Fire Ball Script Will Not Rotate The Front To The Right Position?

Asked by
LuaDLL 253 Moderation Voter
7 years ago
Edited 7 years ago

So, I am making a fireball script when a player press F and it works except for the rotation of the fireball, i want the rotation to be facing the same way the player is facing and I don't know what I did wrong here.

Script:

01local plr = game.Players.LocalPlayer
02local mouse = plr:GetMouse()
03CanShoot = true
04In = false
05 
06repeat wait() until plr.Character
07local char = plr.Character
08 
09mouse.KeyDown:connect(function(key)
10    if key == "f" then
11        if CanShoot == true  and In == false then
12            In = true
13            CanShoot = false
14            local part = Instance.new("Part")
15            local fire = Instance.new("Fire",part)
View all 35 lines...

The Problem Is At Line 26 And I Don't Know What I Did Wrong Here.

0
Please don't use mouse.KeyDown. It is deprectaed. You should use ContextActionService or UserInputService. Plus, connect is depricated, use Connect. Plus, if you remove the second argument of Instance.new, then do the properties, after that, do [instacnename].Parent = [instanceparent] saSlol2436 716 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Remove Line 26 and replace it with this. [MAKE SURE THE PART IS NOT ANCHORED!]

1local move = Instance.new("BodyVelocity", part)
2move.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
3move.Velocity = plr.Character.Torso.CFrame.lookVector*100

Brief explaination; We will create an object called BodyVelocity. Then we will change the MaxForce (or max power) and changing the Velocity to face the character's direction, defined as plr.Character.Torso.CFrame.lookVector . lookVector is the property of CFrame, AND NO OTHER ELSE!! lookVector just means where an object is looking or where the surface called FrontSurface of a part is facing. You can change the 100 to something else since it tells how fast it is going, and 100 is kinda fast. Hope this helps!

0
It does not work for me. LuaDLL 253 — 7y
0
Oh now I see the reason reading it one more time. You need to make sure the part is NOT anchored and CanCollide must be true. Sorry for the late response, I have been. CounterBoy123 53 — 7y
Ad

Answer this question