Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make this fireball follow me?

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

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)

1 comment

0

Ah ok, thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.