Hi! - The game I am currently working on has the tool inside of a script, and that script chooses the gamemodes, and gives the tool out to the players. This script is essential, considering it gives out all of the player's GUI(s), and such. However, this script has suddenly stopped distributed the tool for no reason whatsoever. I've tried all the fixes I could - and ended up asking here. Tell me what you guys think the error is - please!
I warn you - it's very long!
gtool = script.GameTool:clone()
script:remove()
roundTime = {
["Free for All"] = 600
}
gd = workspace.GlobalDistribution
function consoleMessage(text,color)
local Msg = Instance.new("StringValue",game.Lighting.ServerConsole)
Msg.Value = "Global Distribution: "..text
if color then
Msg.Name = color
end
game.Debris:AddItem(errorMsg,3)
end
function alert(text,color3)
local Msg = Instance.new("StringValue",game.Lighting.ServerAlerts)
Msg.Value = text
if color then
Instance.new("Color3Value",Msg).Value = color3
end
end
game.Lighting.ServerDamage.ChildAdded:connect(function(child)
if child:IsA("NumberValue") then
if pcall(function()
workspace:findFirstChild(child.Name):findFirstChild("Humanoid"):TakeDamage(child.Value)
end) then
if workspace:findFirstChild(child.Name).Humanoid.Health <= 0 and workspace:findFirstChild(child.Name).Humanoid.MaxHealth > 5 then
workspace[child.Name].Humanoid.MaxHealth = 1
consoleMessage("Attempting to add killmessage","Bright yellow")
if #game.Lighting.ServerKillMessages:GetChildren() > 5 then
game.Lighting.ServerKillMessages:GetChildren()[1]:Destroy()
end
Spawn(function()
wait(0.1)
if child:findFirstChild("KillMessage") then
consoleMessage("damageData contains killmessage","Bright yellow")
local ksmg = child.KillMessage:clone()
ksmg.Parent = game.Lighting.ServerKillMessages
else
consoleMessage("damageData did not contain killmessage","Bright yellow")
end
end)
end
else
consoleMessage("ERROR: Failed to distribute damage to "..child.Name,"Bright red")
end
child:Destroy()
end
end)
game.Players.PlayerAdded:connect(function(player)
consoleMessage(player.Name.." has connected.","Toothpaste")
player.CharacterAdded:connect(function()
gtool:clone().Parent = player.Backpack
player.Backpack["GameTool"].Archivable = false
player.Backpack["GameTool"]["woop"].Archivable = false
end)
local warning = game.Lighting.Resources.GUI.Warning:clone()
Spawn(function()
repeat wait(0) until player:findFirstChild("PlayerGui") and player.PlayerGui:findFirstChild("Menu")
warning.Parent = player.PlayerGui
local leedstat = Instance.new("BoolValue",player)
leedstat.Name = "leaderstats"
Instance.new("StringValue",leedstat).Name = "Users"
wait(4)
warning.Agree:TweenPosition(UDim2.new(0.35,0,.7,0),"Out","Quad",1,true)
warning.Agree.MouseButton1Click:connect(function()
warning.Agree:TweenPosition(UDim2.new(0.5,-100,2,0),"Out","Quad",1,true)
warning.Frame:TweenPosition(UDim2.new(0,0,2,0),"Out","Quad",0.7,true)
game.Debris:AddItem(warning,2)
player.PlayerGui.Menu.Frame.Active = true
end)
end)
end)
game.Players.ChildRemoved:connect(function(player)
if player:IsA("Player") then
consoleMessage(player.Name.." has disconnected.","Toothpaste")
local bin = workspace.Ignore:findFirstChild(player.Name.."HandleBin")
if bin then bin:Destroy() end
local objectsInIgnore = workspace.Ignore:GetChildren()
consoleMessage("workspace.Ignore contains:","Brick yellow")
for x = 1, #objectsInIgnore do
if objectsInIgnore[x]:IsA("Part") and objectsInIgnore[x].CanCollide then
objectsInIgnore[x]:Destroy()
else
consoleMessage(objectsInIgnore[x].Name,"Brick yellow")
end
end
end
end)
game.Lighting.ServerPing.ChildAdded:connect(function(packet)
if packet:IsA("NumberValue") then
if pcall(function() packet.Parent = game.Players:findFirstChild(packet.Name) end) then
else
consoleMessage("GlobalDistribution ERROR: Failed to send pafcket to "..packet.Name,"Bright red")
end
end
end)
function RidStuff()
if not workspace:findFirstChild("Drops") then
Instance.new("Model",workspace).Name = "Drops"
end
if allTheThings then
for x = 1, #allTheThings do
allTheThings[x]:disconnect()
end
end
allTheThings = {
workspace.ChildAdded:connect(function(child)
if child:IsA("Hat") then
game.Debris:AddItem(child,10)
end
end),
workspace.Drops.ChildAdded:connect(function(child)
game.Debris:AddItem(child,15)
end),
workspace.Ignore.Effects.ChildAdded:connect(function(child)
game.Debris:AddItem(child,10)
end),
game.Lighting.ServerDamage.ChildAdded:connect(function(child)
game.Debris:AddItem(child,10)
end),
game.Lighting.ServerSound.ChildAdded:connect(function(child)
game.Debris:AddItem(child,10)
end),
game.Lighting.ServerConsole.ChildAdded:connect(function(child)
game.Debris:AddItem(child,10)
end),
game.Lighting.ServerAlerts.ChildAdded:connect(function(child)
game.Debris:AddItem(child,10)
end)
}
end
RidStuff()
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
---------- GAME ROUNDS ---- GAME ROUNDS ---- GAME ROUNDS ---- GAME ROUNDS ---- GAME ROUNDS ----------
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
lastmap = nil
function spawnMap(gMode)
local mapName
mapLibrary = game.Lighting.Resources.Maps
if workspace:findFirstChild("Map") then
workspace:findFirstChild("Map"):Destroy()
end
if workspace.Ignore:findFirstChild("Flags") then
workspace.Ignore.Flags:Destroy()
Instance.new("Model",workspace.Ignore).Name = "Flags"
end
if gMode == "Free for All" then
repeat
map = mapLibrary.FFA:GetChildren()[math.random(1,#mapLibrary.FFA:GetChildren())]
until map ~= lastmap
lastmap = map
map = map:clone()
mapName = map.Name
gd.gameMap.Value = mapName
map.Name = "Map"
end
alert(gMode.." at "..mapName,Color3.new(0.3,0.8,0))
map.Parent = workspace
if map:findFirstChild("BlueFlag") then
map.BlueFlag.Parent = workspace.Ignore.Flags
end
if map:findFirstChild("RedFlag") then
map.RedFlag.Parent = workspace.Ignore.Flags
end
end
gameMode = gd.gameMode
gameTime = gd.gameTime
gModes = {"Free for All"}
while true do
pcall(RidStuff)
gameMode.Value = gModes[math.random(1,#gModes)]
gameTime.Value = roundTime[gameMode.Value]
spawnMap(gameMode.Value)
repeat
wait(1)
gameTime.Value = gameTime.Value - 1
if gameTime.Value == 10 then
alert("TEN SECONDS REMAIN!",Color3.new(0,0.8,1))
end
until gameTime.Value <= 0
gameMode.Value = ""
local players = game.Players:GetChildren()
alert("ROUND END!",Color3.new(0,0.8,1))
for x = 1, #players do
pcall(function()
players[x].LeftWeapon.Value = "Pistol"
players[x].RightWeapon.Value = "Knife"
if players[x].Character:findFirstChild("Humanoid") then
players[x].Character.Humanoid.Health = 0
end
end)
end
wait(15)
for x = 1, #players do
if players[x]:findFirstChild("LeaderInfo") then
pcall(function()
players[x].LeaderInfo.Kills.Value = 0
players[x].LeaderInfo.Scores.Value = 0
players[x].LeaderInfo.Deaths.Value = 0
players[x].LeaderInfo.Team.Value = 0
end)
end
end
end
- Dragon
EDIT: If needed, I can provide the GameTool as well - but the problem appears to be originating here.
It should be said that the first player to connect is getting the tool, while all other players after him or her are not.

3 comments
The only think I can think of is that you're setting archivable to false for the tool, but I don't know too much about that property. Is this in a normal script or a localscript? And is the tool the only thing not being distributed?
This is a normal script that is distributing the GameTool (hopperbin) - full of local scripts. And yes - the Hopperbin handles the rest of the copying.
This is of course subtracting the map being copied from the Lighting - however - that still works.