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

gui only cloning once when it can clone multiple times?

alright so in my game this is my levelup handler which when someone levels up it is supposed to clone a gui into their PlayerGui which it does fine the first time but after they level up again nothing, i have no idea why it would just quit after one clone

script:

game.Players.PlayerAdded:Connect(function(player)
	local requirements = player:WaitForChild("Requirements")
	local levelrequirement = requirements.RequiredKills
	local leaderstats = player.leaderstats
	local kills = leaderstats.Kills
	local level = leaderstats.Level
	local levelupgui = game.ServerStorage.LevelUp:Clone()
	kills.Changed:Connect(function()
		if kills.Value >= levelrequirement.Value then
		 	print(player.Name.." Leveled Up")
			level.Value = level.Value + 1
			levelupgui.Parent = player.PlayerGui
			wait(5)
			levelupgui:Destroy()
			if level.Value >= 5 then
			levelrequirement.Value = levelrequirement.Value + 20
			else
			levelrequirement.Value = levelrequirement.Value + 15	
			end
		end
	end)
end)

4 comments

0

Try directly referencing the levelupgui through playergui instead of how you're doing it here. Or when it happens, check ingame and see if the gui is still in server storage.

0

it was still in the server storage so ill try directly referencing it but since the server cant see a clients PlayerGui idk if that will work but i will try it

0

ok no that did not work

0

yeah if it was still in storage no point. worth a shot. \

1 answer

Im not sure if you resolved this but try by changing 'levelupgui:Destroy()' to 'levelupgui:Remove()' once again you probably resolved this anyway

2 comments

0

Remove will do the same as Destroy its just deprecated so noone likes it

0

Have you figured this out yet?

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