what i am trying to do is everytime you press "r" then a fireball comes out, and a dialogue interface comes out of the head that says "Fireball!" and then destroys after 4 seconds. also the rotation of the fireball is really off
player = script.Parent.Parent
mouse = player:GetMouse()
char = player.Character
fireballText = "Fireball!"
function onKeyDown(key)
key = key:lower()
if key == "r" then
head = player.Character:FindFirstChild("Head")
fireball = game.Lighting.fireball:clone()
fireball.Parent = game.Workspace
fireball.CFrame = char.Torso.CFrame.lookVector*CFrame.new(8,0,0)
fireball.Name = "fireballClone"
fireball.Velocity = head.CFrame.lookVector*0
game.GetService("Chat"):Chat(head, fireballText, "Bright red")
wait(2)
game.GetService("Chat"):Destroy()
end
end
mouse.KeyDown:connect(onKeyDown)

1 comment
You can't destroy a service. Also, 'game.GetService("Chat")' should be 'game:GetService("Chat")', as 'GetService' is a method.