Trying to Update and Modify the "Gear Card" used in Gear Wars games, but for some reason the Picked gear from the ServerStorage folder is not working...
Any person who made a "Gear Wars" game probably recognise this:
--Item Giver Script By Tenbelow--
local Tool = script.Parent
local gears = game.ServerStorage.Gears:GetChildren() -- Changed this
function onActivated()
-- play sound
magicSound = Tool.Handle:FindFirstChild("MagicSound")
if magicSound == nil then return end
magicSound:Play()
-- GOOD RANDOMIZATION CODE!! --Tenbelows weird randomisation code
numLoops = math.random(0,math.floor(1000*time()))
numLoops = numLoops - (math.floor(numLoops / 10000)*10000)
for i = 1,numLoops do
whichNum = gears[math.random(1,#gears)] -- Changed this
end
-- END OF GOOD RANDOMIZATION CODE!
print("Picked: ")
print(whichNum)
local root = whichNum:Clone()
local instances = root:GetChildren()
if #instances == 0 then
root:Remove()
return
end
root = root:GetChildren()
if #root == 1 then
root = root[1]
else return end
print(root)
root.Parent =
Tool:remove()
end
function onEquipped()
magicSound = Tool.Handle:FindFirstChild("MagicSound")
if magicSound == nil then
magicSound = Instance.new("Sound")
magicSound.Parent = Tool.Handle
magicSound.Volume = 1
magicSound.SoundId = "http://www.roblox.com/asset/?id=35571070"
magicSound.Name = "MagicSound"
end
end
Tool.Activated:connect(onActivated)
Tool.Equipped:connect(onEquipped)pped:connect(onEquipped)

4 comments
i didnt write most of the script, it was made a long time a go, im trying to revamp it so it will get a gear from serverstorage
does it work now ?
does it work now ?
no, you only said the things i did wrong, no improvements