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

How do I make this fireball follow me?

Asked by 9 years ago
player = game.Players.LocalPlayer
mouse = player:GetMouse()

function fireball()
    local ball = Instance.new("Part")
    ball.Name="Fireball"
    ball.Parent=Workspace
    ball.Shape="Ball"
    ball.Size=Vector3.new(1, 1, 1)
    ball.Transparency=0
    ball.Anchored=false
    ball.CanCollide=true
    ball.BrickColor=BrickColor.new("Bright orange") 
end

function keyDown(key)
    key = key:lower()
    if key == "z" then
        fireball()
    end
end

mouse.KeyDown:connect(keyDown)

It only spawns in one area. How do I make it so, when you move, they spawn where you move??

1 answer

Log in to vote
0
Answered by
MrFlimsy 345 Moderation Voter
9 years ago

You need to set the CFrame property to the area where you want it to appear.

player = game.Players.LocalPlayer
mouse = player:GetMouse()

function fireball()
    local ball = Instance.new("Part")
    ball.Name="Fireball"
    ball.Parent=Workspace
    ball.Shape="Ball"
    ball.Size=Vector3.new(1, 1, 1)
    ball.Transparency=0
    ball.Anchored=false
    ball.CanCollide=true
    ball.BrickColor=BrickColor.new("Bright orange") 
    ball.CFrame = player.Character.Torso.CFrame --add this
end

function keyDown(key)
    key = key:lower()
    if key == "z" then
        fireball()
    end
end

mouse.KeyDown:connect(keyDown)
0
Ah ok, thanks! Roboy5857 20 — 9y
Ad

Answer this question