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

How do I get this script work?

Asked by
S3C 5
10 years ago

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

Log in to vote
0
Answered by 10 years ago
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)
0
Weapons come from lighting right? S3C 5 — 10y
Ad

Answer this question