MP Script: Tag!
#1
Here's a basic script you can use to make your game into a fun everlasting game of Tag!

Requirements:
  • A Box or Circle in the workspace named "ItBase", where It goes to start being It
  • A map that's fun for playing tag in

Script:
[lua]
local messages = {"Not enough players :<", "Starting game!", "Choosing %s for it...", "%s is it!", "%s has been tagged and is now it!"}


function waitFor(time)
local old = os.time()
while true do
sleep(0.001)
if os.time() - old == time then
break end end end

function Message(string, time)
game:message(string)
waitFor(time)
game:message()
end

while true do
waitFor(5)
local players = game.Players:getChildren()
if #players < 2 then
Message(messages[1], 3)
else
Message(messages[2], 3)
break end end

waitFor(1)

local playerit = nil
for q = 1, 10 do
local players = game.Players:getChildren()
playerit = players[math.random(1, #players)]
Message(string.format(messages[3], playerit.Name), 0.5)
end

Message(string.format(messages[4], playerit.Name), 3)

playerit.Character.Body.Position = game.World.ItBase.Position
playerit.Character.Body.Label.Text = "It!"
playerit.Character.Body.Fixed = true
waitFor(5)
playerit.Character.Body.Fixed = false

local enabled = true
local itconnect = nil

function Tag(player, hit)
if hit.Name == "Body" then
enabled = false
Message(string.format(messages[5], hit.Parent.Name), 2)
player.Character.Body.Label.Text = player.Name
hit.Label.Text = "It!"
itconnect:disconnect()
hit.Position = game.World.ItBase.Position
hit.Fixed = true
waitFor(5)
hit.Fixed = false
itconnect = link(hit.Collided, function(hit)
Tag(game.Players[hit.Parent.Name], hit)
end)
end end


itconnect = link(playerit.Character.Body.Collided, function(hit)
Tag(playerit, hit)
end)
[/lua]
Reply


Messages In This Thread
MP Script: Tag! - by Qwertygiy - 07-30-2011, 05:06 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)