Driver's License Frame Visible Issue

Hello, I been scripting for some hours now and finally got everything working EXCEPT whenever I reset the character and equip the tool in my inventory the frame is invisible. Not sure what’s the issue. Here’s the frame visible and invisible code down below. Any suggestions?

Frame Visible and Invisible Code:

local IDCard = script.Parent
local DriverLicense = game.Players.LocalPlayer.PlayerGui:WaitForChild("DriverLicense").DriverLicenseFrame

IDCard.Equipped:Connect(function()
	DriverLicense.Visible = true
end)

IDCard.Unequipped:Connect(function()
	DriverLicense.Visible = false
end)

1 Like

I set the ResetOnSpawn property of the GUI to false and everything worked.

Though the GUI will remain in its state (visible/invisible), make a script that’ll hide it once player dies.

Ahhh, so I turned the property off and it worked. Now when it’s equipped and I reset it’s still there so I 'll make another script hiding it when the player dies.

How should the script look like. Hmmmmm

Would the script look like this?

local IDCard = script.Parent
local DriverLicense = game.Players.LocalPlayer.PlayerGui:WaitForChild("DriverLicense").DriverLicenseFrame

IDCard.Equipped:Connect(function()
	DriverLicense.Visible = true
end)

IDCard.Unequipped:Connect(function()
	DriverLicense.Visible = false
end)

if game.Players.LocalPlayer.Character.Humanoid.Health == 0 then
	DriverLicense.Visible = false
end
if game.Players.LocalPlayer.Character.Humanoid.Health == 0 then
	DriverLicense.Visible = false
end

No since this is only checked once (when the script first executes). Listen for the local player’s Humanoid.Died event/signal to fire.
https://developer.roblox.com/en-us/api-reference/event/Humanoid/Died

1 Like