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

How Do I make it choose a random ID from the Table each time I click?

Asked by
neoG457 315 Moderation Voter
9 years ago
AttackList = {"http://www.roblox.com/Asset?ID=277328828", "http://www.roblox.com/Asset?ID=277925886", "http://www.roblox.com/Asset?ID=277938710"}

local AnimId = AttackList[(math.random(1, 3))]

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function(key)

    local TestAttack = Instance.new("Animation")
TestAttack.AnimationId = AnimId
local animTrack = Player.Character.Humanoid:LoadAnimation(TestAttack)
animTrack:Play()
end)

This script works fine apart from the fact that it only chooses 1 ID and you have to reset to get another one. So how do I make it choose a random ID from the table each time I click?

Answer this question