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
|
  |
| Joined: 02 Feb 2014 |
| Total Posts: 1041 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 02 Feb 2014 |
| Total Posts: 1041 |
|
| |
|
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
|
  |
| Joined: 02 Feb 2014 |
| Total Posts: 1041 |
|
|
| 12 Jul 2016 02:25 PM |
| Alright, I'll try. Thanks! |
|
|
| Report Abuse |
|
|