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

how do you make a script that makes a gui appear when you hold a tool?

Asked by 4 years ago

as shown in the title, i need help with this script, i tried a bit but they all failed, anyone able ot help out

1
Post the script here, we will not script stuff for you as this is not a request site. killerbrenden 1537 — 4y
1
But, use the :Equipped function on the tool script. killerbrenden 1537 — 4y
0
sorry, ill post it next time CelticFury600 4 — 4y

1 answer

Log in to vote
3
Answered by 4 years ago

I put a local script inside of the tool and wrote this.

script.Parent.Equipped:Connect(function() --// When the player equips the tools, the events will fire
    local player = game:GetService("Players").LocalPlayer --// Finds the player
    if player then --// Checks if the player is valid
        local targGui = player:WaitForChild("PlayerGui"):FindFirstChild("PUT THE NAME OF THE GUI YOU WANT HERE") --// Finds the targeted gui
        if targGui then --// Checks if the gui is valid
            targGui.Enabled = true --// Enables the gui
        end
    end
end)

script.Parent.Unequipped:Connect(function() --// When the player unequips the tool, the events will fire
    local player = game:GetService("Players").LocalPlayer --// Finds the player
    if player then --// Checks if the player is valid
        local targGui = player:WaitForChild("PlayerGui"):FindFirstChild("PUT THE NAME OF THE GUI YOU WANT HERE") --// Finds the targeted gui
        if targGui then --// Checks if the gui is valid
            targGui.Enabled = false --// Disables the gui
        end
    end
end)

Make sure you change the name of the targeted gui where it says PUT THE NAME OF THE GUI YOU WANT HERE

Also make sure you have your gui disabled in starter gui and reset on respawn is enabled.

Hope this helped, if it didn't work let me know so I can fix it for you.

Remember: This is not a request site.

0
I Upvoted Your Post And Replys As You Are Correct This Is NOT A Request Site And This Script Is Helpful For Others. EnzoTDZ_YT 275 — 4y
1
Thank you! killerbrenden 1537 — 4y
Ad

Answer this question