Hi, I'm wondering how I edit this modulescript to make it delete a Localscript named CutsceneScript from all players' playerguis. I'm using the script I used to insert it as a base. I already tried mightwork:Destroy, but that didn't work, and I'm not sure what I'm doing wrong.

local module = {}
local mightwork = script.CutsceneScript
function module.awawa()
for _, player in pairs(game.Players:GetPlayers()) do
	local playerGui = player.PlayerGui
	if playerGui and playerGui:FindFirstChild('mightwork') == nil then
		local mightClone = mightwork:Clone()
		mightClone.Parent = playerGui
		end
	end
end

return module

3 comments

0

where are you calling the functino

0

I believe you can't access the gui in PlayerGui from the server unless it is explicitly cloned in from the server. You'd want to use a RemoteEvent, firing to every client and deleting it with a path. I'd assume this isn't a localscript either as you cannot access the PlayerGui from another client at all.

0

i'm calling it via a command in studio as require(game.Workspace.ModuleScript).awawa()