|
| 17 Jan 2017 11:22 AM |
So, there's this script that I've spent quite a bit of time making and i was testing it to see if it would work. I fixed some errors but then I came accross one that doesn't make any sense to me. The Error says Value is not a valid member of UDim2, I know what that means but looking in the script, I can't find where I went wrong. If someone could help then that would be great.
Here's the WHOLE script:
local val = 0 local previous = 0
function Run2() script.Parent.Parent.Amount.Value = script.Parent.Parent.Amount.Value + 1 script.Parent.place.Value = script.Parent.place.Value + 1 end
function Run1(New) print("1") if previous > New then script.Parent.place.Value = script.Parent.place.Value + 1 elseif previous < New then script.Parent.place.Value = script.Parent.Position.Value - 1 ^^This is where the error occurs^^ end if script.Parent.place.Value == 1 then val = 0 elseif script.Parent.place.Value == 2 then val = 0.2 elseif script.Parent.place.Value == 3 then val = 0.4 elseif script.Parent.place.Value == 4 then val = 0.6 elseif script.Parent.place.Value == 5 then val = 0.8 elseif script.Parent.place.Value >= 6 then val = 1 script.Parent.Visible = false end script.Parent.Position = UDim2.new(0,0,val,0) end
script.Parent.Activation.Changed:connect(Run2) script.Parent.Parent.Amount.Changed:connect(Run1)
while true do previous = script.Parent.Parent.Amount.Value wait(1) end
Thnx,0071ronman |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2017 11:25 AM |
Is it definitely an integer/float value? I can't see anything else wrong with it.
And can Position recieve a UDim2? Thought it was only Vector3 Seeing as there aren't four planes in 3D space
|
|
|
| Report Abuse |
|
|
pketny
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1162 |
|
|
| 17 Jan 2017 11:26 AM |
script.Parent.Position is an UDim2 (the position of a 2D GUI element)
You're trying to .Value that, but it doesn't have that property.
You also can't + 1 on a UDim2 since it's 2 tables within a table.
http://wiki.roblox.com/index.php?title=UDim2 |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2017 11:27 AM |
Oh ye lol. My apologies.
And isn't he just adding to a single value, it doesn't include UDim2 until the end of the function.
|
|
|
| Report Abuse |
|
|
pketny
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1162 |
|
|
| 17 Jan 2017 11:30 AM |
You probably mean to do this:
script.Parent.place.Value = script.Parent.place.Value - 1
On that line, just the autocorrect kicking in |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2017 11:39 AM |
| OMGGGGGGGGG SO ANNOYING I can't belive i missed that!!!! |
|
|
| Report Abuse |
|
|