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

Why is this script just putting a ki blast in the middle of the map?

Asked by 7 years ago
 kblast = script.Parent
 player = game.Players.LocalPlayer
mouse = player:GetMouse()
function fireblast()
    local ki = Instance.new("Part", workspace)
    game.Debris:AddItem(ki,4)
    ki.Shape = ("Ball")
    ki.Material = ("Neon")
    ki.Size = Vector3.new(1,1,1)
    ki.TopSurface = ("Smooth")
    ki.BottomSurface = ("Smooth")
    ki.Transparency = (0.6)
    ki.BrickColor = BrickColor.new("Toothpaste")
    ki.Anchored = true
    ki.CanCollide = false
    ki.Name = ("KiBlast")



    ki.CFrame = CFrame.new(ki.Position,mouse.hit.p)
    print("ki blast launched")

    local vel = Instance.new("BodyVelocity")
    vel.Velocity = ki.CFrame.lookVector * 90
    vel.maxForce = Vector3.new(math.huge,math.huge,math.huge)
    vel.Parent = ki

    local spark = Instance.new("Sparkles", ki)



end

kblast.Activated:connect(fireblast)

2 answers

Log in to vote
0
Answered by 7 years ago

It doesn't look like you assign its Position or CFrame at all. You can do that by doing something like this:

kblast = script.Parent
 player = game.Players.LocalPlayer
 --[[ new thing woo --]]
local character = player.Character
if not character then
character = player.CharacterAdded:wait()
end
character = player.Character
 --[[ new thing woo --]]
mouse = player:GetMouse()
function fireblast()
    local ki = Instance.new("Part", workspace)
    game.Debris:AddItem(ki,4)
    ki.Shape = ("Ball")
    ki.Material = ("Neon")
    ki.Size = Vector3.new(1,1,1)
    ki.TopSurface = ("Smooth")
    -- [[ NEW PART HERE TOO WHOOOOOOOOO BOY --]]
ki.CFrame = character.LeftArm.CFrame
     -- [[ NEW PART HERE TOO WHOOOOOOOOO BOY --]]

    ki.BottomSurface = ("Smooth")
    ki.Transparency = (0.6)
    ki.BrickColor = BrickColor.new("Toothpaste")
    ki.Anchored = true
    ki.CanCollide = false    ki.Name = ("KiBlast")
    ki.CFrame = CFrame.new(ki.Position,mouse.hit.p)
    print("ki blast launched")
    local vel = Instance.new("BodyVelocity")
    vel.Velocity = ki.CFrame.lookVector * 90
    vel.maxForce = Vector3.new(math.huge,math.huge,math.huge)
    vel.Parent = ki
    local spark = Instance.new("Sparkles", ki)
end
kblast.Activated:connect(fireblast)

Ad
Log in to vote
0
Answered by 7 years ago

Have you set the KiBlast.Position? The position should be the character's position plus a few bits foward so it comes from the front.

Also, if this is a DBZ game, Good luck!

Answer this question