Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my fireball animation only firing once and not every time the player presses F(the keycode)?

Asked by 5 years ago

when you press F this is supposed to fire. Of course, that's in a local script, Which works and is irrelevant to this.

local remotes = game:GetService('ReplicatedStorage'):WaitForChild('Remotes')
local items = game:GetService('ReplicatedStorage'):WaitForChild('Items')
local ps = game:GetService('PhysicsService')


remotes.FireBlast.OnServerInvoke = function(gamer)
    local body = gamer.Character
    if body then 
        local huma = body.Humanoid
        local arm = body:FindFirstChild('Right Arm')
    if huma and huma:FindFirstChild('Animator') and arm then
        local animation = Instance.new('Animation')
        animation.AnimationId = 'rbxassetid://2585156325'
        animation = huma:LoadAnimation(animation)

        animation:Play()
        animation.KeyframeReached:Wait(0.2)

        local orb = items:FindFirstChild('FireBlast'):Clone()
        orb.CFrame = arm.CFrame * CFrame.new(0,-2.4,0)
        orb.Parent = workspace


        local vel = Instance.new('BodyVelocity', orb)
        vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
        vel.Velocity = arm.CFrame.UpVector * -100

        game.Debris:AddItem(orb, 1.2)

        orb:SetNetworkOwner(nil)
    end
    end
end

^^this is in ServerScriptService and in a normal script

for some reason the animation only plays once. Please Help!

0
The local script is relevant since it's handling the Remote firing and input. Why not use a RemoteEvent for this too? xPolarium 1388 — 5y
0
In this case it would be better to use a local script to play the animation then only ask the server to create the part. Local parts would also be useful. User#5423 17 — 5y
0
Do you have the script for pressing the key? fr2013 88 — 5y
0
i do. AdminAyush 10 — 5y

Answer this question