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

Why wont the Screen GUI show when the tool is equipped?

Asked by 5 years ago

For some reason, whenever I try and equip the tool it just wont do it. I tried a couple of different things and both did not work. I'm using a local script so only the person with the tool equipped can see it instead of the entire server. Any reason as to why this code below wont work?

script.Parent.Equipped:Connect(function()
    if game.StarterGui.PartUI.Enabled == false then
    game.StarterGui.PartUI.Enabled = true
    end
end)

script.Parent.Unequipped:Connect(function()
    if game.StarterGui.PartUI.Enabled == true then
    game.StarterGui.PartUI.Enabled = false
    end
end)

1 answer

Log in to vote
0
Answered by
Joshument 110
5 years ago

The problem you have here is that you are referencing the StarterGui, which clones into each player when they spawn. If this gets edited, though, the player won't see it until they respawn, but in most cases, it resets on death. What you want to edit here is the PlayerGui. You can easily access it with game.Players.LocalPlayer.PlayerGui.PartUI as you are using a localscript.

0
Tried, but it didn't work. iiBuilder_Boy 27 — 5y
0
Show me the script. Joshument 110 — 5y
0
How? iiBuilder_Boy 27 — 5y
0
Post a new question or make a pastebin. Joshument 110 — 5y
Ad

Answer this question