RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"turn a tool called Egg into a random Tool from A folder called Weapons from ServerStorage"
-- server script (ServerScriptService) local ServerStorage = game:GetService("ServerStorage") local Weapons = ServerStorage.Weapons local Players = game:GetService("Players") local function onEggActivated(player) local randomWeapon = Weapons:GetChildren()[math.random(1, #Weapons:GetChildren())] local newWeapon = randomWeapon:Clone() newWeapon.Parent = player.Backpack end Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local eggTool = character:WaitForChild("Egg") if eggTool then eggTool.Activated:Connect(function() onEggActivated(player) end) end end) end)