Hello, last time I made a post to fix a bug, but now I have a bigger problem, now when I create this command it allows the member with the appropriate gamepass can use this command.
However if a member uses it or I use it everything works, but the problem is that when we use another command the game thinks that we are doing just this command, the same when we speak in the game without using a command, I don't not even know why when we speak the game understands that it is a command it tries to modify the music while we do not ask since we are only talking and not using the command.
My Script :
game.Players.PlayerAdded:Connect(function(plr)
local marketPlace = game:GetService("MarketplaceService")
local admin = false
local owner = false
local canChangeMusic = false
--local canChangeVolOfMusic = false
--local canTP = false
if plr.UserId == 96919359 or plr.UserId == 155674478 then
owner = true
admin = true
canChangeMusic = true
--canChangeVolOfMusic = true
--canTP = true
end
if marketPlace:UserOwnsGamePassAsync(plr.userId, 11275677) then
canChangeMusic = true
--canChangeVolOfMusic = true
--canTP = true
end
plr.Chatted:connect(function(msg)
if string.sub((msg),1,9) == "/musicid " and admin or owner or canChangeMusic then
local a = string.sub(msg,10)
game.Workspace:FindFirstChild("Music").SoundId = "rbxassetid://"..a
game.Workspace:FindFirstChild("Music").Volume = 0.1
game.Workspace:FindFirstChild("Music").Playing = true
game.Workspace:FindFirstChild("Music").TimePosition = 0
end
end)
end)

2 comments
Replace line 24 with "if string.sub((msg),1,9) == "/musicid " and (admin or owner or canChangeMusic) then"
Thank you is a fix my command.