I made a script that would fire whenever a player's leaderboard points changes however its giving me this error:
00:42:37.830 - Workspace.Script:11: attempt to index number with 'Changed'
Does this mean that I can't use numbers with the changed event? This is my entire script if it helps:
01 | game.Players.PlayerAdded:Connect( function (player) |
02 |
03 | local leaderstats = Instance.new( "Folder" ) |
04 | leaderstats.Name = "leaderstats" |
05 | leaderstats.Parent = player |
06 |
07 | local Points = Instance.new( "IntValue" ) |
08 | Points.Name = "Points" |
09 | Points.Parent = leaderstats |
10 |
11 | Points.Value.Changed:Connect( function (Value) |
12 | if Value = = 5 then |
13 | game.Workspace.door 1. Transparency = 0.5 |
14 | game.Workspace.door 1. CanCollide = false |
15 | end |
16 | end ) |
17 | end ) |
you are trying to get .changed event on an integer or number value. .Changed is not an event of a integer or string you should instead be doing something like below this might have syntax errors but you should follow it
01 | game.Players.PlayerAdded:Connect( function (player) |
02 |
03 | local leaderstats = Instance.new( "Folder" ) |
04 | leaderstats.Name = "leaderstats" |
05 | leaderstats.Parent = player |
06 |
07 | local Points = Instance.new( "IntValue" ) |
08 | Points.Name = "Points" |
09 | Points.Parent = leaderstats |
10 |
11 | Points.Changed:Connect( function (Value) -- get changed of object not objects value |
12 | if tostring (Value) = = "Value" then -- if property is value |
13 | if Value = = 5 then |
14 | game.Workspace.door 1. Transparency = 0.5 |
15 | game.Workspace.door 1. CanCollide = false |
16 | end |
17 | end |
18 | end ) |
19 | end ) |