Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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)
0
^ Wrong. The server can access the PlayerGui through RemoteEvents. DeceptiveCaster 3761 — 5y
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 SerpentineKing 3885 — 5y
Ad

Answer this question