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 » Scripters
Home Search
 

Re: Variable problem...

Previous Thread :: Next Thread 
Inigo18 is not online. Inigo18
Joined: 02 Feb 2014
Total Posts: 1041
12 Jul 2016 01:27 PM
local OK = false
local dialogue = plr.PlayerGui.Dialog.Dialog
local replies = plr.PlayerGui.Replies.Container

spawn(function()
while wait(.25) do
for i = 1,#SomeTable do
if (SomeTable [i].Torso.Position - plr.Character.Torso.Position).magnitude >= 8 then
SomeTable [i].Head.E.ImageLabel.ImageTransparency = 1
else
SomeTable [i].Head.E.ImageLabel.ImageTransparency = 0
TextToSay = TableOfPeeps[i].Saying.Value
Person = SomeTable [i].Name
script.Person.Value = SomeTable [i]
OK = true
end
end
end
end)

SOME FUNCTION
if OK == true then

The problem is with OK, I have this variable OK that I need to set to true in order for the next function to work, plus, OK gets set to true when the player is more than 8 studs close to the model in the table. Keep in mind the table has multiple models.
So if what I had to do is to set OK to false when the player isn't closer than 8 studs, then it will kinda override, and I won't be able to do the next function with any of the models in the table except the last model in the table. Anyone got any idea?
Thanks for reading thus far!
Report Abuse
Inigo18 is not online. Inigo18
Joined: 02 Feb 2014
Total Posts: 1041
12 Jul 2016 01:31 PM
bumpp
Report Abuse
alelollo is not online. alelollo
Joined: 27 Jun 2013
Total Posts: 33
12 Jul 2016 01:39 PM
just saying, instead of using magnitude use DistanceFromCharacter
And instead of doing >=8 just do >7


so instead of having to put more words just put


"if plr:DistanceFromCharacter(SomeTable[i].Torso.Position)>7 then"

instead of

if (SomeTable [i].Torso.Position - plr.Character.Torso.Position).magnitude >= 8 then


or u could just ignore this post completely.
Report Abuse
Inigo18 is not online. Inigo18
Joined: 02 Feb 2014
Total Posts: 1041
12 Jul 2016 01:41 PM
I'll try DistanceFromCharacter, thanks for the tips!
Magnitude doesn't get decimals?

Also, any ideas about the variable problem?
Report Abuse
Inigo18 is not online. Inigo18
Joined: 02 Feb 2014
Total Posts: 1041
12 Jul 2016 02:07 PM
Buuump
Report Abuse
fghik is not online. fghik
Joined: 06 May 2008
Total Posts: 3288
12 Jul 2016 02:11 PM
The type of code you're working with is a little more than I'm used to. But in my experience with variables, they tend to bug out... a LOT when you establish them in odd places

ESPECIALLY when it comes to Values.


It's gotten to the point where I literally type

script.Parent.Parent.LOOKAVALUE.Value = script.Parent.Parent.LOOKAVALUE.Value + 1

in a lot of my scripts when I cant figure out what's going wrong.


Consider duplicating your script and in the copy try skipping the variables and do a run? Make sure its all functional without them, then if alls good, establish variables is maybe a different spot?
Report Abuse
Inigo18 is not online. Inigo18
Joined: 02 Feb 2014
Total Posts: 1041
12 Jul 2016 02:25 PM
Alright, I'll try. Thanks!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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