Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get this script work?

NOTE: This is the script for random weapons from lighting that you equip each time you spawn. What I am trying to do is a FPS and everyone is by themselves and what I want is everyone to equip a random weapon (tool) from lighting each time they spawn.

Please get this work, S3C

wait()
local plr = game.Players.LocalPlayer
repeat wait(.1) until plr.Character

local weapons = game.Lighting.Weapons:GetChildren()
weapons[math.random(1,#weapons)]:Clone().Parent = plr.Character

1 answer

Game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        local tools = Game.ServerStorage.Tools:GetChildren()
        local newTool = tools[math.random(1, #tools)]:Clone()
        newTool.Parent = Player.Backpack
        Character.Humanoid:EquipTool(newTool)
    end)
end)

1 comment

0

Weapons come from lighting right?

This discussion is preserved as it was. New answers, comments, and votes are closed.