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: Table help?

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 03:33 PM
local myTableone = {"Smallpath1"}
game.Players.PlayerAdded:connect(function(Player)
b = Player:FindFirstChild("leaderstats")
c = Player.leaderstats:FindFirstChild("Money")
game.Workspace["Path175$"].Head.Touched:connect(function(hit)
if Player.TeamColor == BrickColor.new("Bright red") then
if c.Value == 175 then
c.Value = c.Value -175
game.Workspace["Path175$"]:Remove()
game.Lighting.myTableone[1]:clone()
game.Lighting.myTableone[1].Parent = Workspace
game.Workspace.myTableone[1].CFrame = CFrame.new(-144.5, 2, 56)
end
end
end)
end)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 03:35 PM
game.Workspac[myTableone[1]].CFrame = CFrame.new(-144.5, 2, 56)

Perhaps that?
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 03:36 PM
game.Workspace[myTableone[1]].CFrame = CFrame.new(-144.5, 2, 56)

Sorry, I trimmed off the 'e'. :o
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 03:39 PM
Right now I'm testing it.But why did you say that?
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 03:42 PM
game.Workspace.myTableone[1].CFrame

That would make it look for something named 'myTableone[1]' inside Workspace.

Using brackets, and the fact that tables have strings, you can grab what the first string is, there.

What 'game.Workspace[myTableone[1]].CFrame' would be, is the same as..

game.Workspace["Smallpath1"].CFrame
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 03:44 PM
OH, but it still didn't work.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 03:45 PM
Output?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 03:47 PM
No output.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 03:58 PM
Bump....
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 04:20 PM
local myTableone = {"Smallpath1"}
game.Players.PlayerAdded:connect(function(Player)
b = Player:FindFirstChild("leaderstats")
c = Player.leaderstats:FindFirstChild("Money")
game.Workspace["Path175$"].Head.Touched:connect(function(hit)
if Player.TeamColor == BrickColor.new("Bright red") then
if c.Value == 175 then
c.Value = c.Value -175
game.Workspace["Path175$"]:Remove()
game.Lighting.myTableone[1]:clone()
game.Lighting.myTableone[1].Parent = Workspace
game.Workspace.myTableone[1].CFrame = CFrame.new(-144.5, 2, 56)
end
end
end)
end)

Let's go through it, then..

'Smallpath1' is a brick in Workspace.
When a Player joins the game, a function that searches for the values in leaderstats.. What is the point of b and c being there?
When a brick named 'Head' in the model named 'Path175$' gets touched, a new function runs. If the TeamColor is Br Red, then the player's money goes down 175, ONLY IF the value of the money, beforehand, is 175.
After subtracting 175, you remove a brick in Workspace named 'Path175$'.
The next three lines have to be changed.

local z = game.Lighting[myTableone[1]]:Clone().Parent = Workspace
z:MakeJoints()
game.Workspace[myTableone[1]].CFrame = CFrame.new(-144.5, 2, 56)

After that, the ends close the functions and all other statements.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 04:38 PM
Dude, I know how it works. It's just not working.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 04:41 PM
I do not think that you read my entire post. Please go back and read it again.
Report Abuse
DihydrogenOxide is not online. DihydrogenOxide
Joined: 20 Feb 2011
Total Posts: 642
20 Sep 2011 04:47 PM
if c.Value == 175 then
c.Value = c.Value -175

Should be:

if c.Value >= 175 then
c.Value = c.Value -175

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and breaker of combos::]-
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 04:55 PM
Miz, in short..

What I told you to do in the post you refused to read..

game.Workspace["Path175$"]:Remove()
game.Lighting.myTableone[1]:clone()
game.Lighting.myTableone[1].Parent = Workspace
game.Workspace.myTableone[1].CFrame = CFrame.new(-144.5, 2, 56)

Should be..

local z = game.Lighting[myTableone[1]]:Clone().Parent = Workspace
z:MakeJoints()
game.Workspace[myTableone[1]].CFrame = CFrame.new(-144.5, 2, 56)
Report Abuse
nickcool9999 is not online. nickcool9999
Joined: 04 Dec 2007
Total Posts: 1528
20 Sep 2011 04:57 PM
game.Workspace[myTableone[1]].CFrame = CFrame.new(-144.5, 2, 56)
kthx
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 05:04 PM
@grimm

Workspace.BIG:9: unexpected symbol near '='


Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
20 Sep 2011 05:08 PM
Change it to this then..?

local z = game.Lighting[myTableone[1]]:Clone()
z.Parent = game.Workspace
z:MakeJoints()
game.Workspace[myTableone[1]].CFrame = CFrame.new(-144.5, 2, 56)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 05:15 PM
Stil didn't work! No ouput!
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
20 Sep 2011 05:19 PM
Try changing the name of the block with a dollar sign in it. I'm fifty-fifty on that being a syntactical problem.
Report Abuse
nickcool9999 is not online. nickcool9999
Joined: 04 Dec 2007
Total Posts: 1528
20 Sep 2011 05:29 PM
It's not a syntax problem unless the string is in string.format().
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
20 Sep 2011 05:30 PM
My friend said that I should use script.Parent because I used game.WOrkspace to much. But I can't say script.Parent because I'm gonna have more objects in the table
Also, that didn't work :(
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
20 Sep 2011 05:38 PM
Try this:

local myTableone = {"Smallpath1"}
for i,v in pairs(myTableone) do

game.Workspace["Path175$"].Head.Touched:connect(function(hit)
b = hit.Parent:findFirstChild("leaderstats")
c = b:findFirstChild("Money")
if hit.Parent.TeamColor == BrickColor.new("Bright red") then
if c.Value >= 175 then
c.Value = c.Value - 175
game.Workspace["Path175$"]:Remove()
local hi = game.Lighting[v]:clone()
hi.Parent = workspace
hi.CFrame = CFrame.new(-144.5, 2, 56)
else print("MOOAR MONEY NAO")
end
end
end)
end
Report Abuse
nickcool9999 is not online. nickcool9999
Joined: 04 Dec 2007
Total Posts: 1528
20 Sep 2011 05:47 PM
local myTableone = {"Smallpath1"}
function CharacterSpawned(Player, char, b, c)
while Player.Character
if Player.TeamColor == BrickColor.new("Bright red") then
if c.Value >= 175 then
c.Value = c.Value -175
while char:FindFirstChild("Torso") == nil do
wait()
end
game.Workspace.myTableone[1].CFrame = CFrame.new(-144.5, 2, 56)
end
end
end
game.Players.PlayerAdded:connect(function(Player)
b = Player:FindFirstChild("leaderstats")
while b == nil do
local ch = Player.ChildAdded:wait()
if ch.Name == "leaderstats" then
b = ch
end
end
c = Player.leaderstats:FindFirstChild("Money")
while c == nil do
local ch = b.ChildAdded:wait()
if ch.Name == "Money" then
c = ch
end
end
if Player.Character ~= nil then
CharacterSpawned(Player, Player.Character, b, c)
end
Player.CharacterAdded:connect(function(char)
CharacterSpawned(Player, char, b, c)
end)
end)
Report Abuse
nickcool9999 is not online. nickcool9999
Joined: 04 Dec 2007
Total Posts: 1528
20 Sep 2011 05:48 PM
This is a fixed version of my post.

local myTableone = {"Smallpath1"}
function CharacterSpawned(Player, char, b, c)
if Player.TeamColor == BrickColor.new("Bright red") then
if c.Value >= 175 then
c.Value = c.Value -175
while char:FindFirstChild("Torso") == nil do
wait()
end
game.Workspace.myTableone[1].CFrame = CFrame.new(-144.5, 2, 56)
end
end
end
game.Players.PlayerAdded:connect(function(Player)
b = Player:FindFirstChild("leaderstats")
while b == nil do
local ch = Player.ChildAdded:wait()
if ch.Name == "leaderstats" then
b = ch
end
end
c = Player.leaderstats:FindFirstChild("Money")
while c == nil do
local ch = b.ChildAdded:wait()
if ch.Name == "Money" then
c = ch
end
end
if Player.Character ~= nil then
CharacterSpawned(Player, Player.Character, b, c)
end
Player.CharacterAdded:connect(function(char)
CharacterSpawned(Player, char, b, c)
end)
end)
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