local Player = game.Players.LocalPlayer local gun = game.Player.Backpack:WaitForChild("PSTL") gun.Equipped:connect(function(mouse) Player.PlayerGui.ScreenGui.Frame.TextLabel.Text = "PSTL" end)
I'm having troubles with changing the text of a TextLabel when a tool is equipped,
Line 2 is your problem, you did not define it correctly. To find a specific tool in Backpack like PSTL you must define it like this
local Player = game.Players.LocalPlayer local Backpack = Player:WaitForChild("Backpack") local gun = Backpack:WaitForChild("PSTL") gun.Equipped:connect(function(mouse) Player.PlayerGui.ScreenGui.Frame.TextLabel.Text = "PSTL" end)
Make sure the tool has a handle otherwise the equipped event won't fire, also on line 2 of your code, it should be
local gun = Player.Backpack:WaitForChild("PSTL") since you already have Player referenced as the local player
Complete Code
repeat wait() until game:GetService'Players'.LocalPlayer -- Just to be safe local Player = game.Players.LocalPlayer local gun = Player:WaitForChild'Backpack':WaitForChild'PSTL' gun.Equipped:connect(function(mouse) -- Make sure your tool has a handle so this event fires. Player:WaitForChild'PlayerGui'.ScreenGui.Frame.TextLabel.Text = "PSTL' end)