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
#2
Yesss!

Now we need someone who is able to host a server.
Reply
#3
I'm going to try to re-set up my laptop for it...
Reply
#4
Very nice! I'm probably going to change this and make it into a Hide and Seek. Big Grin
[Image: AmZJnA9.png]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)