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)