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: Please help me write this.

Previous Thread :: Next Thread 
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 09:35 AM
How would I make a leaderboard that records obby stages when you step on a button and when you die you spawn on the button you stepped on last?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 09:59 AM
I just made this script and haven't tested it. If it doesn't work, tell me what the output says.

How to use:
1) Insert this script (the whole thing) into workspace
2) Make a model in workspace called "Checkpoints"
3) Insert all the checkpoint spawns into this model
4) Name each checkpoint spawn in the order they go. (The first one should be named "1" (no quotes), the second "2", third, "3", 27th "27" etc)
5) hope it works.

game.Players.PlayerAdded:connect(function(np)
local stats = Instance.new("IntValue", np)
stats.Name = "leaderstats"
local stage = Instance.new("IntValue", stats)
stage.Name = "Stage"
np.CharacterAdded:connect(function(nc)
local player = game.Players:GetPlayerFromCharacter(nc)
if nc:findFirstChild("Torso") ~= nil then
local checkpoint = workspace.Checkpoints[game.Players:GetPlayerFromCharacter(nc).leaderstats.Stage.Value]
nc.Torso.CFrame = checkpoint.CFrame + Vector3.new(0, checkpoint.Size.y / 2 + 3, 0)
end
end)
end)
for _, v in pairs(workspace.Checkpoints:GetChildren()) do
v.Touched:connect(function(h)
if h.Parent:findFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(h.Parent)
if player ~= nil then
player.leaderstats.Stage.Value = v.Name
end
end
end)
end
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 10:02 AM
droid pointed out something stupid on steam, here's a revised version (still untested)

game.Players.PlayerAdded:connect(function(np)
local stats = Instance.new("IntValue", np)
stats.Name = "leaderstats"
local stage = Instance.new("IntValue", stats)
stage.Name = "Stage"
np.CharacterAdded:connect(function(nc)
if nc:findFirstChild("Torso") ~= nil then
local checkpoint = workspace.Checkpoints[np.leaderstats.Stage.Value]
nc.Torso.CFrame = checkpoint.CFrame + Vector3.new(0, checkpoint.Size.y / 2 + 3, 0)
end
end)
end)
for _, v in pairs(workspace.Checkpoints:GetChildren()) do
v.Touched:connect(function(h)
if h.Parent:findFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(h.Parent)
if player ~= nil then
player.leaderstats.Stage.Value = v.Name
end
end
end)
end
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:03 AM
Do I put this in the brick?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 10:06 AM
*-.-

i gave you step-by-step instructions. and i quote:

"1) Insert this script (the whole thing) into workspace
2) Make a model in workspace called "Checkpoints"
3) Insert all the checkpoint spawns into this model
4) Name each checkpoint spawn in the order they go. (The first one should be named "1" (no quotes), the second "2", third, "3", 27th "27" etc)
5) hope it works."
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
26 Aug 2012 10:08 AM
blind = idiot
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:15 AM
Well I don't have any comeback for that.
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:15 AM
The thing is idk how to view the output.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 10:20 AM
The script works fine, I just tested it. I added a small modification to make you start at stage 1 instead of stage 0 though:

game.Players.PlayerAdded:connect(function(np)
local stats = Instance.new("IntValue", np)
stats.Name = "leaderstats"
local stage = Instance.new("IntValue", stats)
stage.Name = "Stage"
stage.Value = 1
np.CharacterAdded:connect(function(nc)
if nc:findFirstChild("Torso") ~= nil then
local checkpoint = workspace.Checkpoints[np.leaderstats.Stage.Value]
nc.Torso.CFrame = checkpoint.CFrame + Vector3.new(0, checkpoint.Size.y / 2 + 3, 0)
end
end)
end)
for _, v in pairs(workspace.Checkpoints:GetChildren()) do
v.Touched:connect(function(h)
if h.Parent:findFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(h.Parent)
if player ~= nil then
player.leaderstats.Stage.Value = v.Name
end
end
end)
end
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:31 AM
How do I make it so that I spawn at the stage?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 10:32 AM
you should spawn there automagically

i didnt test that part tho, actually
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:34 AM
I tested it and it didn't work.
(I don't have any spawnlocations other than the default one where you spawn in the middle.)
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 10:35 AM
so now go tell me the output

"but i don't know how to open the output"

go google it
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:38 AM
11:37:47 - Touched is not a valid member of Script
11:37:47 - Script "Workspace.Checkpoints.Script", Line 15
11:37:47 - stack end
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
26 Aug 2012 10:39 AM
...

step 1: Insert the script into workspace
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 10:46 AM
OK and it still doesn't spawn.
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 01:47 PM
bump
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 04:31 PM
bump please help
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
26 Aug 2012 07:06 PM
Please help me! I need to know how to make the person spawn at the brick.
Report Abuse
blindbird17 is not online. blindbird17
Joined: 23 Jan 2012
Total Posts: 1027
27 Aug 2012 07:06 PM
I need some help people.
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