Hey guys, so I was following AlvinBlox's tutorial on how to make a fireball(https://www.youtube.com/watch?v=NIJqp5UuILg), and then when tutorial ended, i fixed weird curving by changing max force velocity from 5000 to math.huge. But, there is a problem that I have, and it isnt seen in Alvin's video, even tho our codes are almost same. When I press Q to launch a fireball, firstly it spawns, waits for ~1 second and only then launches. Here are the scripts:

--Script
local fireball = game.ServerStorage:WaitForChild("Fireball")

game.ReplicatedStorage.Fireball.OnServerEvent:Connect(function(player)
	
	local character = player.Character
	local newFireball = fireball:Clone()
	newFireball.CFrame = character.HumanoidRootPart.CFrame
	
	local bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	bodyVelocity.Velocity = (character.HumanoidRootPart.CFrame.lookVector*250)
	bodyVelocity.Parent = newFireball
	
	newFireball.Parent = workspace
	
	local touchConn
	
	touchConn = newFireball.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			if hit.Parent.Name ~= player.Name then
				hit.Parent:BreakJoints()
				if touchConn ~= nil then touchConn:Disconnect() end
				newFireball:Destroy()
				end
		end
	end)
	
	wait(2)
	
	if touchConn ~= nil then touchConn:Disconnect() end
	newFireball:Destroy()
	
end)

And Local Script.

--Local Script
local UserInputService = game:GetService("UserInputService")

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local debounce = false

UserInputService.InputBegan:Connect(function(Input , IsTyping)
	if not IsTyping then
		if not debounce then
			debounce = true
			
			if Input.KeyCode == Enum.KeyCode.Q then
				game.ReplicatedStorage.Fireball:FireServer()
				
			end
			
			wait(.001)
			debounce = false
		end
	end
end)

This is my first experience at these type of forums, so feel free to correct me if I did something wrong. Thank you all in advance.

2 comments

0

Is the delay caused by changing the max force to math.huge instead of 5000?

0

Hello Cyz, I tried putting values back to 5000 but fireball's speed just got slower. But, there is one more difference, is that when there arent any humanoid objects nearby, fireball works like in alvin's video but without a curve. Even though I'm also using "Drooling Zombies" as test objects.