Title is self explanatory. Server script:
RS.Barrage.OnServerEvent:Connect(function(player, stand, barraging) --stand is the stand model, barraging is the bool
local weld = stand.PrimaryPart.Controller
local stand_anim = stand.AnimationController:LoadAnimation(script.Barrage)
stand_anim:Stop()
if barraging == true then
print(player.Name.."'s stand "..stand.Name.." is barraging")
TS:Create(weld, TweenInfo.new(0.4), {['C0'] = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame), ['C1'] = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(0,1.5,-2))}):Play()
stand_anim.Looped = true
stand_anim:Play()
else
print(player.Name.."'s stand "..stand.Name.." has stopped barraging")
stand.AnimationController:LoadAnimation(script.Barrage):Stop()
TS:Create(weld, TweenInfo.new(0.4), {['C0'] = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame), ['C1'] = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-2.5, 1, 2))}):Play()
end
end)
Local script:
...
if active then
if input.KeyCode == Enum.KeyCode.E then
if barrage_db == false then
barraging = true
barrage:FireServer(stand, true)
task.wait(barrage_cd)
barrage_db = false
if barrage_db == false then
barrage_db = true
task.wait(barrage_cd)
barrage_db = false
end
end
end
end
end
end)
UIS.InputEnded:Connect(function(input, typing)
if typing then return end
if active then
if input.KeyCode == Enum.KeyCode.E then
if barraging == true and barrage_db == false then
barraging = false
barrage_db = true
barrage:FireServer(player.Character:FindFirstChildWhichIsA("Model"), false)
task.wait(barrage_cd)
barrage_db = true
end
end
end
end)