:clone() problem

hello, I have a problem with the :clone()
in the script, when a person touches a part, it clones “CutsceneScript” but the problem is that the script clones a lot of times the “CutsceneScript”, so each time I end up with a lot of “CutsceneScript” in the PlayerGui file when I want it to clone just once!
Script :

function t(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid") 
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if not plr:FindFirstChild("Pawn") then
		if (humanoid ~= nil) then
			local CPN = hit.Parent.Name
			local clone = script.CutsceneScript:Clone()
			clone.Parent = game.Players[CPN].PlayerGui
			humanoid.WalkSpeed = 0

end
	end
	end

script.Parent.Touched:Connect(t)

Just do a Check to see if in the PlayerGui the CutsceneScript is nil

if plr.PlayerGui:FindFirstChild('CutsceneScript') == nil then
1 Like

Ohhhh… Thx :smiling_face_with_three_hearts:!

Please mark as solution if someone helped :confused:

1 Like