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: Not getting past this point.

Previous Thread :: Next Thread 
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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 is not online. 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
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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 is not online. 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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
10 Jan 2014 05:45 PM
We posted basically the same time, anyway, that doesn't seem to work.
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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 is not online. 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 is not online. 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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 04:47 AM
Bump.
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 05:10 AM
Bump2
Report Abuse
breuning is not online. 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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 07:15 AM
I think I get what your saying. How would I fix this then?
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 01:35 PM
Bump
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 01:53 PM
Bumpa
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jan 2014 01:55 PM
db = script.DBValue

db.Value = true
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 02:31 PM
B
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
11 Jan 2014 02:42 PM

if game.ServerStorage:findFirstChild(thingyname.Name) then
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
11 Jan 2014 03:51 PM
^ Tried that, didn't work.


Bump.
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
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
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
12 Jan 2014 08:49 AM
Bump
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
12 Jan 2014 06:21 PM
Bump
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