How to change string value based on players group?

So I have this gui that when hovering over a part with a child named ShowText, it will put the ShowText value as the gui, and enable it, basically telling the player what clicking the object does. For my door though, I want it to switch. Which wouldnt be hard, but I have no idea how I would get the player. Should I do a PlayerAdded function in a script thats parent is the String? and it just checks if the player is in the group. I have no clue, any help?

image

I came up with this script, it does not work though, any help? Its local and should be changing the text depending if im in the group or not, and I did try a group im not in, and it doesnt change.

local Groups = {5173782};

local function isGroupTrue(plr)
	for i,v in pairs(Groups) do
		if plr:IsInGroup(v) then
			return true
		end
	end
	return nil
end

game:GetService("Players").PlayerAdded:Connect(function(plr)
	if isGroupTrue(plr) then
		script.Parent.Value = "Click to enter Bloxy Lab"
				else
		script.Parent.Value = "You cannot enter this building"
            end
end)

So when ur mouse is hovering the part?

Yes, the showtext has the text the gui shows.

There exists a function mouse.Hit, check that and whent the hit’s children is your part, then enable ur gui

No no, im saying, I want this specific showtext value to change depending on if a player is in a group or not.

Maybe if isGroupTrue(plr) ~=nil then

I posted the script I attempted above, I dont know if that helps.

I meant




local Groups = {5173782};

local function isGroupTrue(plr)
	for i,v in pairs(Groups) do
		if plr:IsInGroup(v) then
			return true
		end
	end
	return nil
end

game:GetService("Players").PlayerAdded:Connect(function(plr)
	if isGroupTrue(plr)  ~= nil then
		script.Parent.Value = "Click to enter Bloxy Lab"
				else
		script.Parent.Value = "You cannot enter this building"
            end
end)

Nah it didn’t work. I dont know if its because this is a local script, the gui script is also local, so I really dont know how to go about this.