Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Attempt to index local boolean value? [fixed]

Asked by 5 years ago
Edited 5 years ago
  1. `gamepasses = game:GetService('MarketplaceService')

game.Players.PlayerAdded:Connect(function(plr)

game.Workspace:WaitForChild(plr.Name)

game.Workspace[plr.Name]:WaitForChild('Humanoid')

local ownsmusic = Instance.new('BoolValue', plr)

ownsmusic = false

ownsmusic.Name = 'ownedmusic'

local gotspeed = Instance.new('BoolValue', plr)

gotspeed = false

gotspeed.Name = 'ownedspeed'

if gamepasses:PlayerOwnsAsset(plr, '6180493') then

print('Thanks for donating!')

end

if gamepasses:PlayerOwnsAsset(plr, '6180525') then

ownsmusic = true

print('MusicOn')

end

if gamepasses:PlayerOwnsAsset(plr, '6180479') then

gotspeed = true

print('SpeedOn')

end

end)`

This script returns the error: 'Attempt to index local 'ownsmusic' (a boolean value)' at line 7. Why?

Answer this question