I've been working on a fireball script for a game I want to make. I have an animation set up, and the fireball, as well as all of the scripting for it, remote events, localscript, script, etc. I've gone in multiple times and feel that by now, the script should work. However, the script is not working and I still don't know where the problem is. I have tried going in and looking at multiple tutorials, and so far nothing is seeming to work. When I go in to debug the script, I can see that the problem is still there. I don't think that the problem is in the model or the animation, especially since I haven't put in the animation yet. Unfortunately, I can't detect the problem in the code. Is there any help anyone could offer? 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(5000,5000,5000)
bodyVelocity.Velocity = (character.HumanoidRootPart.CFrame.LookVector*130)
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)
Local:
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.E then
game.ReplicatedStorage.Fireball:FireServer()
end
wait(0.01)
debounce = false
end
end
end)
I would also like to add my animation to the fireball, but I don't know where I would insert the animation.
Animation - https://www.roblox.com/library/1394359576/Fireball
