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

When all players teleport to lobby change walk speed?

Asked by 9 years ago

Hi I have been working on my game and my main script for the game. There is a problem to the script. When they all teleport to the lobby I want there speed to go to 16. But it is not working. Can you help? Line 3 and 13

local h = Instance.new("Hint", workspace)
local b = Instance.new("Hint", workspace)
local humanoid = script.Parent:findFirstChild("Humanoid")

while true do
    for g = 10, 0, -1 do
    h.Text = "There is " ..g.. " seconds left"
    wait(1)
end
for i, v in pairs(game.Players:GetPlayers()) do
    v.Character:MoveTo(workspace.lobby.Position)
print("Players teleported!")
humanoid.Walkspeed = 16

end
wait(1)
for t = 10, 1, -1 do
h.Text = "Intermission " ..t
wait(1)
end
for i, v in pairs (game.Players:GetPlayers()) do
    v.Character:MoveTo(workspace.SpeedBrick.Position)
    print("Game started")
end
end


2 answers

Log in to vote
0
Answered by 9 years ago

So, you have wrote the WalkSpeed word wrong. If you have added tools in the player and you want to remove them, write this below the WalkSpeed = 16:

for i,Child1 in ipairs(v.Backpack:GetChildren()) do
    if Child1.ClassName == "Tool" then
        Child1:Destroy()
    end
end

for i,Child2 in ipairs(v.Character:GetChildren()) do
    if Child2.ClassName == "Tool" then
        Child2:Destroy()
    end
end

If you need to add the tools, put the tools in the ServerStorage and put this below the print("The game started"):

for i,Child in ipairs(game.ServerStorage:GetChildren()) do
    Child:Clone().Parent = v.Backpack
end
Ad
Log in to vote
0
Answered by 9 years ago
local h = Instance.new("Hint", workspace)
local b = Instance.new("Hint", workspace)
-- local humanoid = script.Parent:findFirstChild("Humanoid")
-- Making this a local value will only pull one Humanoid.
while true do
    for g = 10, 0, -1 do
    h.Text = "There is " ..g.. " seconds left"
    wait(1)
end
for i, v in pairs(game.Players:GetPlayers()) do
    v.Character:MoveTo(workspace.lobby.Position)
print("Players teleported!")
humanoid = v.Character:FindFirstChild("Humanoid") -- If we put it here, then it'll find the humanoid of the current Character.
humanoid.WalkSpeed = 16
stuff = v.Backpack:GetChildren()
v:Destroy()
end
wait(1)
for t = 10, 1, -1 do
h.Text = "Intermission " ..t
wait(1)
end
for i, v in pairs (game.Players:GetPlayers()) do
    v.Character:MoveTo(workspace.SpeedBrick.Position)
    tool = game.Lighting.TOOLNAMEHERE:clone() -- Put the tool in lighting and replace TOOLNAMEHERE with the Tool's name.
    tool.Parent = v.Backpack
    print("Game started")
end
end

Answer this question