I need some help. I want to check if a player is a Star Creator, be checking if they’re inside of the Star Creator group.
My error is…
attempt to call missing method 'IsInGroup' of string
Now I have check the Roblox docs and they don’t help
The Roblox Docs Code for "IsInGroup"
local Players = game:GetService("Players")
local function onPlayerAdded(player)
if player:IsInGroup(7) then
print("Player is in the Roblox Fan club!")
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
Code
Now this is a Server Script, and the function runs when the client fires a RemoteEvent
-- Sent From Client
SearchEvent.OnServerEvent:Connect(function(Player, SearchedUser)
local Data
local Success, Error = pcall(function()
Data = PlayerData:GetAsync(Players:GetUserIdFromNameAsync(SearchedUser))
end)
local UserId = Players:GetUserIdFromNameAsync(SearchedUser)
local SearchedName = Players:GetNameFromUserIdAsync(UserId)
if SearchedName:IsInGroup(4199740) then -- LINE ERROR! ⚠️
print("Is a star creator")
end
if Success and Data then
SearchEvent:FireClient(Player, UserId, true)
else
SearchEvent:FireClient(Player, UserId, false)
end
end)
No, not really. I want users to be able to search for a user, so I have in my function SearchEvent.OnServerEvent:Connect(function(Player,SearchedUser )
And for some random reason it doesn’t work. You may notice that instead of SearchedUser it’s SearchedName. That’s because I was thinking that, maybe changing from Username → UserId → Username it might work. I think it worked before, but clearly it doesn’t work here.