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
 

Since my last suggestion...

Previous Thread :: Next Thread 
Safii is not online. Safii
Joined: 21 Dec 2012
Total Posts: 70
01 Jan 2013 04:30 AM
Well since my last suggestion to make a game failed i have 2 scripts i want to join together.

My Shop Gui (NOT MADE BY ME) and my Leaderboard (ONCE AGAIN NOT BY ME)

So I need to fuse these 2 together.

Leaderboard script:

-- Ajedi32

--If you look in the model you will notice that there are two variable objects in the model.
-- One of them is named running and the other is named points.

-- Points determines how many points everyone gets if they survive. Running is a variable that
-- can be modified by an external script when the disaster is running.

-- For example, when an external script starts the disaster, then it also needs to modify the
-- running variable to show that the disaster is running. Then when the disaster ends, your
-- script should set the running variable back to false. When this happens, the leaderboard
-- determines who suvived the disaster and gives him points accordingly.

-- NEW! This script now announces who survived!

bin = script.Parent

---------- For Announcing Who Survived
feedbackEnabled = true
function feedback(parent, message)
if not feedbackEnabled then return end
local h = parent:findFirstChild("announcement")
if h ~= nil then
h.Text = message
else
h = Instance.new("Message")
h.Name = "announcement"
h.Text = message
h.Parent = parent
end
end

function removeFeedback(parent, delay)
local h = parent:findFirstChild("announcement")
if h ~= nil then
local txt = h.Text
wait(delay)
if h ~= nil and h.Text == txt then -- Make sure that there is not more feedback.
h:remove()
end
end
end

function compilePlayers(players)
local names = ""
if #players == 1 then return players[1].Name end
for i=1,#players do
if i == #players then
names = names.. "and ".. players[i].Name
else
names = names.. players[i].Name.. ", "
end
end
return names
end
----------

function setTag(parent, type, name, value)

local tag = parent:findFirstChild(name)
if tag ~= nil then
if tag.className == type then
tag.Value = value
else
local newTag = Instance.new(type)
newTag.Name = name
newTag.Value = value
newTag.Parent = parent
end
else
local newTag = Instance.new(type)
newTag.Name = name
newTag.Value = value
newTag.Parent = parent
end
end

function getTag(parent, type, name, default)

local tag = parent:findFirstChild(name)
if tag ~= nil then
if tag.className == type then
return tag.Value
else
print("No tag of the specified name and class was found in ", parent)
return default
end
else
print("No tag named ", name, " found in ", parent)
return default
end
end

function died(player, humanoid)
if player ~= nil then
if humanoid ~= nil then
if humanoid.Health == 0 then
setTag(player, "BoolValue", "survived", false)
end
else
setTag(player, "BoolValue", "survived", false)
end
end
end

running = true
function start()
local players = game.Players:getChildren()
local connections = {}

running = true

for i=1,#players do
if players[i].Character ~= nil then
setTag(players[i], "BoolValue", "survived", true)
table.insert(connections, players[i].Character.Humanoid.Changed:connect(function () died(players[i], players[i].Character.Humanoid) end))
end
end

while running do
wait(1)
end

players = game.Players:getChildren()
local survivedt = {}

for i=1,#players do
local survived = getTag(players[i], "BoolValue", "survived", false)
if survived then
setTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Survivals", getTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Survivals", 0) + 1)
setTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Cash", getTag(players[i]:findFirstChild("leaderstats"), "IntValue", "Cash", 0) + bin.points.Value)
table.insert(survivedt, players[i])
end
end
bin.points.Value = 0



for i=1,#connections do -- Disconnect all previous connections.
connections[i]:disconnect()
end

if #survivedt > 0 then
feedback(game.Workspace, compilePlayers(survivedt).. " survived.")
else
feedback(game.Workspace, "Nobody Survived!")
end
removeFeedback(game.Workspace, 3)
end

function runningChanged(run)
print("Running Changed")
if run.Value == true then
start()
else
running = false
end
end

function newPlayer(player)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local points = Instance.new("IntValue")
points.Name = "Cash"
points.Value = 0

local survivals = Instance.new("IntValue")
survivals.Name = "Survivals"
survivals.Value = 0

points.Parent = stats
survivals.Parent = stats
stats.Parent = player
end

game.Players.ChildAdded:connect(newPlayer)
bin.running.Changed:connect(function () runningChanged(bin.running) end)
print("Leaderboard Loaded")

YES it was a free model XD

And since its a Shop Gui with no script whatsoever here is a link to the one I am referring to:

http://www.roblox.com/Advanced-Gun-Shop-Gui-item?id=74999025

yeah so I can't use the points to buy things if anyone could help me fuse these 2 together would be greatly appreciated :)
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
01 Jan 2013 04:30 AM
>5:30 am


Sorry, I can't help.
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
01 Jan 2013 04:40 AM
You're basically asking us to make the script for you, which is clearly against policies. We fix, not make (or "fuse")
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