Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

local HasPass or vip Doesnt work?

i made a chat thingy but the vip or local haspass but it doesnt work because it is underlining player

local plrs = game.Players
local sss = game.ServerScriptService
local groupId = 7870490
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

chatService.SpeakerAdded:Connect(function(plr)
	
	local speaker = chatService:GetSpeaker(plr)
	local HasPass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserID,11925441)
	
	
	if plrs[plr]:IsInGroup(groupId) and HasPass then		

		speaker:SetExtraData('NameColor', Color3.fromRGB(0, 255, 178))
		speaker:SetExtraData('Tags', {{TagText = plrs[plr]:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(0, 255, 77)}})		
		speaker:SetExtraData('Tags', {{TagText = 'Fan VIP', TagColor = Color3.fromRGB(0, 222, 255)}})
		
	elseif HasPass then

	    speaker:SetExtraData('NameColor', Color3.fromRGB(255, 0, 0))
		speaker:SetExtraData('ChatColor', Color3.fromRGB(124, 238, 255))
		speaker:SetExtraData('Tags', {{TagText = 'Owner', TagColor = Color3.fromRGB(0, 222, 255)}})	
		
	elseif plrs[plr]:IsInGroup(groupId) then
		
		speaker:SetExtraData('NameColor', Color3.fromRGB(0, 255, 178))
		speaker:SetExtraData('Tags', {{TagText = plrs[plr]:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(0, 255, 77)}})		
		speaker:SetExtraData('Tags', {{TagText = 'Fan VIP', TagColor = Color3.fromRGB(0, 222, 255)}})		
		end
	end)
end)

1 comment

0

You havent set up the variable "player" beforehand. I assume you want to use your "plr" variable you already have set up.

1 answer

In this case, player is an undeclared variable. By default, all variables are declared nil. Thus the error occurs there.

I suggest replacing variable player with plr.

Sample: Observing that undeclared variables are nil.

print(wow_potato) -- nil

This discussion is preserved as it was. New answers, comments, and votes are closed.