The frame is shown to the other players and I need to be corrected

The problem I have is when I touch a part with a specific name a gui with a frame opens, but when a player touches the block and the frame opens the other players also the gui opens without touching the block.

What I want is for each individual player to be able to see his or her Gui when touching the block.

Here is the local script that I use to open the gui and I want to say that the local script I place it in the screngui not directly in the frame

local part = game.Workspace.TactoPart1
local gui = script.Parent.Frame

part.Touched:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if plr then
		gui.Visible = true
	end
end)

part.TouchEnded:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if plr then
		gui.Visible = false
	end
end)
1 Like

just clone it into the players playergui, and when the player stops touching you can just use FindFirstChild to find the ui in player gui (and then destroy it)

** It doesn’t work, what do you suggest?**

local part = game.Workspace.TactoPart1
local guiTemplate = script.Parent.Frame

part.Touched:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if plr then
		
		local playerGui = guiTemplate:Clone()
		playerGui.Parent = plr.PlayerGui
		playerGui.Visible = true

		
		part.TouchEnded:Connect(function(touchEndHit)
			local endPlr = game.Players:GetPlayerFromCharacter(touchEndHit.Parent)
			if endPlr == plr then
				playerGui:Destroy()
			end
		end)
	end
end)
1 Like

oh, your cloning a frame, you need to clone a screengui and then put the frame inside of the gui
i made a model for this

(im not the best scripter)

1 Like

your model is good but it interferes with another script but there is no problem because I fixed it with a different script thank you for helping me

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