Hello! So I’m trying to make a fireball that goes up and down but It doesn’t work and errors
Script
local FireBall = script.Parent
local UpValue = 24
local DownValue = 24
local function FireBallGoBackLow()
for i = 0.1, UpValue do
wait(0.01)
FireBall.Position = FireBall.Position + Vector3.new(0,1,0)
end
end
local function FireBallGoHigh()
for i = 0.1, DownValue do
wait(0.01)
FireBall.Position = FireBall.Position - Vector3.new(0,1,0)
end
end
FireBall.Position = Vector3(26530.449, 491.5, -13710.29):Connect(FireBallGoHigh)
FireBall.Position = Vector3(26530.449, 515.5, -13710.29):Connect(FireBallGoBackLow)
Error
13:34:29.497 Workspace.FireBall.Handler:19: attempt to call a table value - Server - Handler:19
13:34:29.497 Stack Begin - Studio
13:34:29.497 Script 'Workspace.FireBall.Handler', Line 19 - Studio - Handler:19
13:34:29.498 Stack End - Studio
15:32:05.738 Connect is not a valid member of Vector3 - Server - Handler:19
15:32:05.738 Stack Begin - Studio
15:32:05.739 Script 'Workspace.FireBall.Handler', Line 19 - Studio - Handler:19
15:32:05.739 Stack End - Studio
I’m assuming the vector is where the ball is meant to move to?
If so, I would instead pass that vector3 through the function itself. The function should use tweeting instead of for loops, this allows you to have more smooth movement.
You can’t directly connect to a Vector3, because its a type, not an object.
When I did this then, the fireball goes up and then down but after that the script just stops working.
local FireBall = script.Parent
local UpValue = 25
local DownValue = 25
if FireBall.Position == Vector3.new(26531.449, 495.5, -13710.29) then
for i = 0.1, UpValue do
wait(0.01)
FireBall.Position = FireBall.Position + Vector3.new(0,1,0)
end
end
if FireBall.Position == Vector3.new(26531.449, 520.5, -13710.29) then
for i = 0.1, DownValue do
wait(0.01)
FireBall.Position = FireBall.Position - Vector3.new(0,1,0)
end
end
You’ll need to put it in a while true loop so that it repeats.
local FireBall = script.Parent
local UpValue = 25
local DownValue = 25
while true do
if FireBall.Position == Vector3.new(26531.449, 495.5, -13710.29) then
for i = 0.1, UpValue do
wait(0.01)
FireBall.Position = FireBall.Position + Vector3.new(0,1,0)
end
end
if FireBall.Position == Vector3.new(26531.449, 520.5, -13710.29) then
for i = 0.1, DownValue do
wait(0.01)
FireBall.Position = FireBall.Position - Vector3.new(0,1,0)
end
end
end
@aguythatsreallybored, the script keeps exhausting and now I legit have to make it so every 1 second that the fire ball goes down, it doesn’t even go smoothly anymore and looks like the game is running on 1 FPS