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:
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Points = Instance.new("IntValue") Points.Name = "Points" Points.Parent = leaderstats Points.Value.Changed:Connect(function(Value) if Value == 5 then game.Workspace.door1.Transparency = 0.5 game.Workspace.door1.CanCollide = false end end) 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
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Points = Instance.new("IntValue") Points.Name = "Points" Points.Parent = leaderstats Points.Changed:Connect(function(Value) -- get changed of object not objects value if tostring(Value) == "Value" then -- if property is value if Value == 5 then game.Workspace.door1.Transparency = 0.5 game.Workspace.door1.CanCollide = false end end end) end)