|
| 10 Jan 2014 05:34 PM |
No errors, as it is in online mode. I have used a message to show when it gets past a certain point. Not quite sure what is wrong with it. It is in a gui text button. 'n' is the name of a string value and it's value is Gravity Coil. The Gravity Coil is in ServerStorage. ------ 'c' is the name of a number value, and its value is 399. It is taken away from the player's points. Called Noties.
local m = Instance.new("Message",game.Workspace) script.Parent.MouseButton1Down:connect(function() local plr = game.Players.LocalPlayer m.Text = plr.Name local ls = plr:findFirstChild("leaderstats") m.Text = "found ls" if ls then local pts = ls:findFirstChild("Noties") m.Text = "found2" if pts then m.Text = "found3" local thingyname = n.Value if game.ServerStorage.thingyname then --<<<<<< DOESNT GET PAST HERE m.Text = "found gc" local thing = game.ServerStorage.thingyname:Clone() m.Text = pts.Value.."(~1)" pts.Value = pts.Value - script.Parent.Parent.c.Value m.Text = pts.Value if thing:IsA("Hat") then m.Text = "hat" thing.Parent = plr.Character else m.Text = "gear" thing.Parent = plr.Backpack end else --<<<< ALSO, DOESNT CHANGE THE TEXT TO THIS m.Text = "i cant find it" end end end end) |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 10 Jan 2014 05:39 PM |
if game.ServerStorage:findFirstChild("thingyname") then
Make sure 'thingyname' is in ServerStorage with correct spelling. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 05:40 PM |
^ How about you reed the script. That is a varaible.
Use findfirstchild just with not quotes around thingyname |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 05:43 PM |
@Smil,
That wouldn't work. I have tried " if game.ServerStorage:findFirstChild(thingyname) then ", but with no success. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 10 Jan 2014 05:44 PM |
Oh ok. My mistake. Sorry.
if game.ServerStorage:findFirstChild(thingyname) then
There we go. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 05:45 PM |
| We posted basically the same time, anyway, that doesn't seem to work. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 05:46 PM |
Just a quick question:
In Lua, can you turn a variable into a string? In Python, you can do str(2), and it will turn it to a string (Resulting in "2"). Can you do this?
DrRandomous |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 10 Jan 2014 05:53 PM |
Yeah, tostring(2)
tonumber("6") works other way too
And I'm unsure why it didnt work. I will look again tomorrow. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 10 Jan 2014 05:54 PM |
| I think the problem lies within this line: local thingyname = n.Value. What is 'n'? |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 06:11 PM |
'n' is the name of a string value and it's value is Gravity Coil. The Gravity Coil is in ServerStorage. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2014 06:13 PM |
Anyway, must sleep. I will check In about six hours for replies.
Thanks for the help so far, andy hanks in advance! DrRandomous |
|
|
| Report Abuse |
|
|
| |
|
| |
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 11 Jan 2014 06:26 AM |
game.ServerStorage:findFirstChild(n.Value) then
value is a property of a StringValue, ValueObjects always bug around when you set a variable to their Value property
at least they did last time i checked
for example
db = script.DBValue.Value
db = true -- wont change it |
|
|
| Report Abuse |
|
|
|
| 11 Jan 2014 07:15 AM |
| I think I get what your saying. How would I fix this then? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Jan 2014 01:55 PM |
db = script.DBValue
db.Value = true |
|
|
| Report Abuse |
|
|
|
| 11 Jan 2014 02:10 PM |
Sorry, but I'm still extremly confused. I have adapted the script a little, but it doesnt get past the for loop.
local m = Instance.new("Message",game.Workspace) script.Parent.MouseButton1Down:connect(function() local plr = game.Players.LocalPlayer m.Text = plr.Name local ls = plr:findFirstChild("leaderstats") m.Text = "found ls" if ls then local pts = ls:findFirstChild("Noties") m.Text = "found2" if pts then m.Text = "found3" local n = script.Parent.Parent.n m.Text = n.Value for i,v in pairs(game.ServerStorage:GetChildren()) do m.Text = v.Name.." was found!" if v.Name == n.Value then m.Text = "found gc" local thing = v:clone() m.Text = pts.Value.."(~1)" pts.Value = pts.Value - script.Parent.Parent.c.Value m.Text = pts.Value if thing:IsA("Hat") then m.Text = "hat" thing.Parent = plr.Character else m.Text = "gear" thing.Parent = plr.Backpack end end end end end end) |
|
|
| Report Abuse |
|
|
| |
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 11 Jan 2014 02:42 PM |
if game.ServerStorage:findFirstChild(thingyname.Name) then |
|
|
| Report Abuse |
|
|
|
| 11 Jan 2014 03:51 PM |
^ Tried that, didn't work.
Bump. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2014 05:54 AM |
Bump. Really confused why this doesn't work, as I thought you could use values to find something.
Any other ways round this? |
|
|
| Report Abuse |
|
|
| |
|
| |
|