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

I've asked this question 3 times before How can I give tools to all players?

Asked by 8 years ago

Ok so my script I have no errors in the output but why does this not work I followed what others have done heres a video link to show you its my channel just look at the vid https://youtu.be/SQBNFAyPFk0 heres my script the part that I need has a bold bob

-- Made By johndeer2233
-- Make a hint
h = Instance.new("Hint",game.Workspace)

--If there is more than 1 player
while true do
if game.Players.NumPlayers > 1 then
   -- Choosing A Map
   maps = game.ServerStorage.Maps:GetChildren() 
   h.Text =  "Choosing A Map"
   wait(3) 
   ranGame = math.random(1,#maps)
   ChosenGame = maps[ranGame]   
   h.Text =  "Map Chosen: "..ChosenGame.Name
   wait(3)
   ChosenGameClone = ChosenGame:Clone()
   ChosenGameClone.Parent = game.Workspace
   wait(3)
-- Teleport Players To Map
local spawns = ChosenGameClone.Spawns:GetChildren()
    for i,v in pairs(game.Players:GetPlayers()) do
        name = v.Name
        check = game.Workspace:FindFirstChild(name)
        if check then
          checkHumanoid = check:FindFirstChild("Humanoid")
         if checkHumanoid then
            v.Character:MoveTo(spawns[i].Position)
            end             
        end 
    end
    --Timer Before Game Starts
for i = 3, 0, -1 do
 h.Text =  "Time Till Game Begins: "..i
wait(1)
end
h.Text = "Game Begins"
-- if certain Maps **Bob**
if ChosenGameClone == "OfficeMap"then
    local players = game.Players:GetChildren()
        for i = 1,#players do 
        local ThrowingKnife = game:GetService("ServerStorage").ThrowingKnife
        local clone = ThrowingKnife:Clone()
        local backpack = players:WaitForChild("Backpack")
        if backpack then
        clone.Parent = players[i].Backpack
        end
    end
end
-- **/Bob**
-- Countdown till game ends
for i = 180, 1, -1 do   
 h.Text =  "Time Left: "..i
wait(1)
end
h.Text = "Game Ended"
ChosenGameClone:Destroy()
else    
   h.Text =  "There Is Not Enough Players To Start"
   wait(3)  
    end
 wait(1)
end
0
What's the error? Shawnyg 4330 — 8y
0
^ JamesLWalker 297 — 8y
0
He said there was no error in the output tho alphawolvess 1784 — 8y

4 answers

Log in to vote
0
Answered by
Kryddan 261 Moderation Voter
8 years ago

If I am not mistaken the problem is that your if statement is checking if ChosenGameClone == "Officemap". But it isn't but the name of it is, with that been said the code inside the if statement never ran because the condition was never correct. so all you have to do is:

if ChosenGameClone.Name == "Officemap" then

0
That was the problem why did I not think of that thanks kryddan you rock! johndeer2233 439 — 8y
0
No problem and good luck. Kryddan 261 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

To do this, you'll require knowledge of Data Stores

This allows the saving of information in forms of Strings, Booleans, Numbers, and Lua Tables (Basically). You cannot save an instance such as a Tool, Part, or anything else you can Insert via Instance.new/Services.

You can learn about Data Stores in the link I provided above.

Log in to vote
0
Answered by 8 years ago
1
--Made by Peachyweachy11
while true do
wait(60) --Waits 1 minute in between games
m = Instance.new("Message") --Creates a new message
local players = game.Players:GetChildren() -- String array where we store all the players
local num = math.random(1,1) --Here, put (1,[total number of maps]
if num == 1 then --Copy and paste this next section for each map, changing the number from 1 to 2, 3, and so on.
m.Parent = game.Workspace --Puts our message in Workspace
m.Text = "Choosing Minigame..." --Feel free to change these next couple of lines as needed
wait(4)
m.Text = "Game Number " ..num.. " Was Chosen"
wait(3)
m.Text = "[MAP NAME]; Maker: [MAP MAKER NAME]"
wait(3)
m.Text = "[INSTRUCTIONS]"
wait(3)
m.Text = "This game lasts for [TIME]."
wait(3)
m.Parent = nil
game.Lighting.Minigame1:clone().Parent = game.Workspace --Change the "Minigame1 to the na
me of your map (stored in Lighting) 
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(­-53.723, 346.569, 91.323)) --Change these coordinates to where you want the players to spawn
game.Lighting.LinkedSword:clone().Parent = players[i].Backpack --Change LinkedSword to the name of a weapon (in Lighting) you want to give to the players. You can either delete this line or copy paste more of it.
end
wait(120) --This is how long the game will last
game.Workspace.Minigame1:Remove() --Change Minigame1 to the name of your map.
m.Parent = game.Workspace
m.Text = "Game over! Thank you for playing!"
wait(3)
m.Text = "You have 1 minute until the start of the next game."
wait(3)
m.Parent = nil
end
m:Remove()
end

Ok i hope this is some help to you.If your trying to make a mini game place i suggest you look at Teleportation scripts But there is one main problem with the map where you have put it. It has to be in lighting in order for it to work.Also make sure you also put your tools in lighting endless you want to give everyone a certain tool when they first join the game then put it in players i think i dont know if that is correct if you put it into players but there is always the way that roblox has added a function that allows you to give players tools for when they first join the game. Hope this script will help you out.

0
Please edit this answer then press the blue lua button and put your code in between the "~~~~~" Kryddan 261 — 8y
0
Ok thank you sorry about that peachyweachy11 5 — 8y
0
Wait sorry can you tell me in a little more detail on what you mean thank you if so. peachyweachy11 5 — 8y
0
After you press edit then there is a few buttons above the text, where one of them is a blue lua button. When you click this two rows of this kind of symbols: ~~~~~~~~ will appear. Put your code in between them so you got one ~~~ row above the code and one below Kryddan 261 — 8y
Log in to vote
0
Answered by 8 years ago

I'm not providing you all the stuff, that you put in your script. But I can give you the stuff for the give it to everyone.

local GP = game.Players:GetChildren()

for i = 1, #GP do

    v = gear:Clone()
    v.Parent = GP[i].Backpack

end

Answer this question