generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: == Why Is It That ==

Previous Thread :: Next Thread 
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:22 AM
--fury2943


object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object
messageText = "A new round will begin..."

message = Instance.new("Message")
message.Text = messageText
backup = model:clone() -- Make the backup
waitTime = 150 --Time to wait between regenerations
wait(math.random(0, waitTime))
while true do
wait(waitTime) -- Regen wait time

message.Parent = game.Workspace
model:remove()

wait(6) -- Display regen message for this amount of time

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
end
end
--fury2943

the message stays for 150 seconds instead of 6, and a new round doesn't actually begin?
Report Abuse
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:23 AM
Other script:


--[[
===============================================
++++++++++++++++Fury2943+++++++++++++++++++++++
===============================================
]]
local game_length = 600 -- every X seconds, end the game, show a message, regen the map, rebalance teams, cause MASSIVE LAG


local red_stuff = game.Workspace.RedTeamRegen:clone()
local blue_stuff = game.Workspace.BlueTeamRegen:clone()


message = nil
function showMessage(text)
-- This function flashes a message to all players
-- Clear the message with hideMessage()

hideMessage() -- Never show more than one message at a time
if message == nil then message = Instance.new("Message") end -- only make a message if we don't have a message object lying around
message.Text = text
message.Parent = game.Workspace
end

function hideMessage()
if message == nil then return end
message.Parent = nil
end


function RegenRed()
game.Workspace.RedTeamRegen:remove()
local new_stuff = red_stuff:clone()
new_stuff.Parent = game.Workspace
new_stuff:makeJoints()
end

function RegenBlue()
game.Workspace.BlueTeamRegen:remove()
local new_stuff = blue_stuff:clone()
new_stuff.Parent = game.Workspace
new_stuff:makeJoints()
end


function clearPlayerInfo()
-- resets KOs and WOs
local players = game.Players:children()
for i = 1, #players do
if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.KOs ~= nil) then players[i].leaderstats.KOs.Value = 0 end
if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Wipeouts ~= nil) then players[i].leaderstats.Wipeouts.Value = 0 end
end
end

function getWinnerInfo()
-- returns a string that we display to everyone about who the winner is

-- in case of tie, no one wins. if someone wants to code something better, be my guest.
local highscore = 0
local winner = "no one"
local tie = false

local players = game.Players:children()
for i = 1, #players do
local pscore = -1
if players[i]:findFirstChild("leaderstats") ~= nil then
if players[i].leaderstats.Points ~= nil then
pscore = players[i].leaderstats.Points.Value
end
end

if pscore == highscore then
tie = true
end

if pscore > highscore then
-- new highscore
highscore = pscore
winner = players[i].Name
tie = false
end
end

if tie == true then return "Tie game!" end

local text = string.format("%s %s %d %s", winner, "Wins with", highscore, "Ko's")
return text
end

function getWinningTeamString()
local red = 0
local blue = 0

local p = game.Players:children()
for i=1,#p do
if (p[i].TeamColor == game.Teams:findFirstChild("Red Team").TeamColor) then
if (p[i]:findFirstChild("leaderstats") ~= nil and p[i].leaderstats.KOs ~= nil) then
blue = blue + p[i].leaderstats.KOs.Value--Change the red and blue to the teams names
end
end

if (p[i].TeamColor == game.Teams:findFirstChild("Blue Team").TeamColor) then
if (p[i]:findFirstChild("leaderstats") ~= nil and p[i].leaderstats.KOs ~= nil) then
red = red + p[i].leaderstats.KOs.Value
end
end
end

if (red == blue) then return "Teams tie!" end

if (red > blue) then return string.format("Red Team wins the match by %d Ko's", red - blue) end

return string.format("Blue Team won the match by %d Ko's"), blue - red)--Change blue to your team and change red to another of your teams

end


while true do
wait(game_length - 5)
showMessage("5 seconds left until end of game!")
wait(5)
hideMessage()
wait(25)

-- put up winning team info
showMessage(getWinningTeamString())
wait(2)
RegenRed()
RegenBlue()

showMessage("Rebalancing teams and launching new game...")
wait(5)
clearPlayerInfo()
game.Teams:rebalanceTeams()

hideMessage()

end
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
05 May 2012 11:25 AM
You wait time is 150, that's why your messages stay for 150 seconds. :3

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:26 AM
But this line:

wait(6) -- Display regen message for this amount of time


Also, the message re-appears every x seconds
So the message reappears on the screen every 150 seconds as of now
Report Abuse
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
05 May 2012 11:26 AM
We dont fix free models.
Report Abuse
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:27 AM
It was a custom-made script for me, but alright.
Report Abuse
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:42 AM
Here's the Model

http://www.roblox.com/Team-win-Model-for-someone-who-asked-item?id=78814306
Report Abuse
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:44 AM
sha-bawmp
Report Abuse
3lex33 is not online. 3lex33
Joined: 08 Oct 2008
Total Posts: 5220
05 May 2012 11:47 AM
Oh suddenly:

waitTime = 150 --Time to wait between regenerations
wait(math.random(0, waitTime))
while true do
wait(waitTime) -- Regen wait time
Report Abuse
ANTH0NY4686 is not online. ANTH0NY4686
Joined: 21 Aug 2011
Total Posts: 7117
05 May 2012 11:59 AM
Isn't that what I have? Lol
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
05 May 2012 10:09 PM
You'll need to re-arrange the script.

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
05 May 2012 10:18 PM
I know it wanst a free model.

I just needed a reason to not fix it.

~!~ Plus One Post ~!~
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image