Textlabel not updating

im trying to script something that changes the textlabel text and frame size when the player is in the mentioned group, but it doesn’t seem to do it

local Group = 00000000
local textlabel = script.Parent
local Frame = script.Parent.Parent.Frame

game.Players.PlayerAdded:Connect(function(plr)
	if  plr:IsInGroup(Group) then
		textlabel.Text = "1/1"
		Frame.Size = UDim2.new(1.01, 0, 0,1, 0)
	end
end)

:IsInGroup requires a number and not a string; remove the “” instead

local Group = 000000 -- your group id

yeah my code already has that, i just edited it out for the post

if thats the case then you’re connecting the PlayerAdded too late; try doing:

local function OnPlayerAdded(player) 
-- the code
end

OnPlayerAdded(game.Players.LocalPlayer)
game.Players.PlayerAdded:Connect(OnPlayerAdded)

Is it a LocalScript or ServerScript?

local script inside the textlabel

u mean this?

local Group = 000000
local textlabel = script.Parent
local Frame = script.Parent.Parent.Frame

local function OnPlayerAdded(player) 
	if  player:IsInGroup(Group) then
		textlabel.Text = "1/1"
		Frame.Size = UDim2.new(1.01, 0, 0,1, 0)
	end
	OnPlayerAdded(game.Players.LocalPlayer)
	game.Players.PlayerAdded:Connect(OnPlayerAdded)
	end

this does not seem to update either, perhaps could it be because IsInGroup does not detect in studio? since ive only tested it on studio and not game yet

no thats not what i meant. you need to put it outside the function

it doesn’t seem to mention it will only work in-game?

1 Like

could u modify the code please ? i dont understand how to

:skull: ok

local Group = 00000000
local textlabel = script.Parent
local Frame = script.Parent.Parent.Frame

local function OnPlayerAdded(player) 
	if plr:IsInGroup(Group) then
		textlabel.Text = "1/1"
		Frame.Size = UDim2.new(1.01, 0, 0, 1, 0)
	end
end

OnPlayerAdded(game.Players.LocalPlayer)
game.Players.PlayerAdded:Connect(OnPlayerAdded)
1 Like

thank u that worked perfectly and now the frame and textlabel both change :+1:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.