So I'm trying to make a fireball script and it works except only I can see it so I tried using a remote event. But the script in server script service is having problems with clone and humanoid. Is there anything I'm missing about remote events?? LocalScript in StarterPack:
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:wait()
local fireball = game.Lighting.FireBending.Fire1
local canattack = true
local checkdeath = true
mouse.KeyDown:connect(function(key)
if key == "z" and canattack == true then
game.ReplicatedStorage.RemoteEvent:FireServer()
end
end)
while checkdeath == true do
wait(.1)
if plr.Character.Humanoid.Health <= 0 then
script:remove()
end
end
Script in ServerScriptService
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
canattack = false
local fire = fireball:Clone()
fire.Parent = workspace
fire.CFrame = char.Humanoid.Torso.CFrame * CFrame.new(0,0,-10)
local bodyv = Instance.new("BodyVelocity")
bodyv.MaxForce = Vector3.new(1e8,1e8,1e8)
bodyv.Velocity = char.Humanoid.Torso.CFrame.lookVector * 150
bodyv.Parent = fire
local fireanim1 = char.Humanoid:LoadAnimation(script.FireAnim1)
local fireanim2 = char.Humanoid:LoadAnimation(script.FireAnim2)
local fireanim3 = char.Humanoid:LoadAnimation(script.FireAnim3)
local choose = math.random(1,3)
if choose == 1 then
fireanim1:Play()
elseif choose == 2 then
fireanim2:Play()
elseif choose == 3 then
fireanim3:Play()
end
wait(2)
fire:remove()
wait(1)
canattack = true
end)
