i want to change the local picked.
local picked = math.Random(1,animations)
not random. like i want the animation to play one by one.
this is the whole ServerScript.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage) punchEvent.Name = "PunchEvent" local animations = {1741614100,1741629151,1744881048} local function onPunchFired(plr) local part = Instance.new("Part") part.Transparency = 0 local char = game.Workspace:FindFirstChild(plr.Name) local humanoid = char.Humanoid local animation = Instance.new("Animation") local picked = --Here animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked] local animTrack = humanoid:LoadAnimation(animation) animTrack:Play() local dmgScript = script.DmgScript:Clone() if picked == 1 then dmgScript.Parent = char.RightLowerArm elseif picked == 2 then dmgScript.Parent = char.LeftLowerArm elseif picked == 2 then dmgScript.Parent = char.RightLowerArm end dmgScript.Disabled = false wait(0.01) dmgScript:Destroy() end punchEvent.OnServerEvent:Connect(onPunchFired)
local ReplicatedStorage = game:GetService("ReplicatedStorage") local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage) punchEvent.Name = "PunchEvent" local animations = {1741614100,1741629151,1744881048} local function onPunchFired(plr) local part = Instance.new("Part") part.Transparency = 0 local char = game.Workspace:FindFirstChild(plr.Name) local humanoid = char.Humanoid local animation = Instance.new("Animation") local picked = --Here animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked] local animTrack = humanoid:LoadAnimation(animation) animTrack:Play() punchSequence() end local last = nil local pickedarm = nil local dmgenabled = false -- don't touch local damage = 10 function punchSequence() dmgenabled = true if not (last == char.RightLowerArm.Name) then last = char.RightLowerArm.Name pickedarm = char.RightLowerArm print(pickedarm.Name) elseif not (last == char.LeftLowerArm.Name) and (last == char.RightLowerArm.Name) then last = char.LeftLowerArm.Name pickedarm = char.LeftLowerArm print(pickedarm.Name) end pickedarm.Touched:connect(applyDamage) end function applyDamage(hit) if hit and dmgenabled then if hit.Parent:FindFirstChild('Humanoid') then local humanoid = hit.Parent:FindFirstChild('Humanoid') humanoid:TakeDamage(damage) dmgenabled = false end end end punchEvent.OnServerEvent:Connect(onPunchFired)