i am trying to make inventory, but the script doesn't detect changed values these values are in the buttons in gui and i am using local script.
01 | local Slot 1 = script.Parent.Slot 1 |
02 | local Slot 2 = script.Parent.Slot 2 |
03 |
04 | script.Parent.Slot 1. Value.Changed:Connect( function () |
05 | print ( "Changed" ) |
06 | if Slot 1. Value.Value = = 1 then |
07 | Slot 1. Image = "http://www.roblox.com/asset/?id=183584653" |
08 | else |
09 | Slot 1. Image = "http://www.roblox.com/asset/?id=1884857885" |
10 | end |
11 | end ) |
12 | script.Parent.Slot 2. Value.Changed:Connect( function () |
13 | print ( "Changed" ) |
14 | if Slot 2. Value.Value = = 1 then |
15 | Slot 2. Image = "http://www.roblox.com/asset/?id=183584653" |
16 |
17 | else |
18 | Slot 2. Image = "http://www.roblox.com/asset/?id=1884857885" |
19 | end |
20 | end ) |
U gotta use GetPropertyChangedSignal
01 | local Slot 1 = script.Parent.Slot 1 |
02 | local Slot 2 = script.Parent.Slot 2 |
03 |
04 | Slot 1 :GetPropertyChangedSignal( "Value" ):Connect( function () |
05 | print ( "Changed" ) |
06 | if Slot 1. Value.Value = = 1 then |
07 | Slot 1. Image = "http://www.roblox.com/asset/?id=183584653" |
08 | else |
09 | Slot 1. Image = "http://www.roblox.com/asset/?id=1884857885" |
10 | end |
11 | end ) |
12 | Slot 2 :GetPropertyChangedSignal( "Value" ):Connect( function () |
13 | print ( "Changed" ) |
14 | if Slot 2. Value.Value = = 1 then |
15 | Slot 2. Image = "http://www.roblox.com/asset/?id=183584653" |
16 |
17 | else |
18 | Slot 2. Image = "http://www.roblox.com/asset/?id=1884857885" |
19 | end |
20 | end ) |
01 | local Slot 1 = script.Parent.Slot 1 |
02 | local Slot 2 = script.Parent.Slot 2 |
03 |
04 | script.Parent.Slot 1. Changed:Connect( function (prop) |
05 | if prop = = "Value" then |
06 | print ( "Changed" ) |
07 | if Slot 1. Value.Value = = 1 then |
08 | Slot 1. Image = "http://www.roblox.com/asset/?id=183584653" |
09 | else |
10 | Slot 1. Image = "http://www.roblox.com/asset/?id=1884857885" |
11 | end |
12 | end |
13 | end ) |
14 | script.Parent.Slot 2. Changed:Connect( function (prop) |
15 | if prop = = "Value" then |
Or, you can use :GetPropertyChangedSignal()