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

It said nothing is there but i check its there any explanations?

debounce = true

script.Parent.Touched:connect(function(hit) 
	local H = hit.Parent:FindFirstChild("Humanoid")
	if H then
		if debounce == true then
			local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
 			local Gui = Player.PlayerGui:FindFirstChild("Teleport1")
			if Gui then
				Gui.Enabled = true
			else
				warn("bruh nothin her")
			end
			wait(0.5)
			debounce = false
		end
	end
end)

so i put a warn in the script if the gui is there but no it warned me so when i look at the player Gui iTS THERE WHAT WHAT IS IT DOING!!

1 answer

I assume this is a Server Script based on how its written, however the Server cannot read or change items in the PlayerGui without the use of a Remote Event / Function, only the client can do this.

Since you only want to open a Gui on the Player its best to keep the entire script Localized

Local Script in StarterGui

local player = game.Players.LocalPlayer
local debounce = true

workspace.Part.Touched:Connect(function(hit) 
	local H = hit.Parent:FindFirstChild("Humanoid")
	if H then
		if debounce == true
			local Gui = script.Parent:FindFirstChild("Teleport1")
			if Gui then
				Gui.Enabled = true
			else
				warn("bruh nothin her")
			end
			wait(0.5)
			debounce = false
		end
	end
end)

2 comments

0

^ Wrong. The server can access the PlayerGui through RemoteEvents.

0

Actually its not wrong, since he's not using an event, what would be the point anyway, it's supposed to open a screengui in the player's gui

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