Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't my gui go away when unequipped?[Solved]

Hello! I am making a chemical thrower gear from Bioshock! I have a gui for it and I made it so when I equip the Tool it becomes visible. However it does not go away when i try this part:


local Tool = script.Parent;

enabled = true
function onButton1Down(mouse)
	if not enabled then
		return
	end

	enabled = false
	mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

	wait(7)
	mouse.Icon = "rbxassetid://207207462"
	enabled = true

end

function onEquippedLocal(mouse)
game.Players.LocalPlayer.PlayerGui.ChemGui.Frame.Visible = true
	if mouse == nil then
		print("Mouse not found")
		return 
	end

	mouse.Icon = "rbxassetid://207207462"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
function Unequipped(mouse)
	game.Players.LocalPlayer.PlayerGui.ChemGui.Frame.Visible = false
	
end
Tool.Unequipped:connect(UnequippedLocal) --Where I have trouble
Tool.Equipped:connect(onEquippedLocal)

I don't know why it is doing this but here is what is in the output: 11:24:54.168 - Attempt to connect failed: Passed value is not a function 11:24:54.169 - Script 'Players.Player1.Backpack.Flame Thrower.Local Gui', Line 34 11:24:54.170 - Stack End 11:24:56.097 - attempt to call a nil value

Any help?

~Minikitkat

3 comments

0

Can I see the whole script because I have no idea what "UnequippedLocal" is.

0

Yes of course

0

Edited, It is a local script and is called LocalGui

1 answer

✓ Accepted answer

There is no UnequippedLocal... you have Unequipped, but not the Local part.

3 comments

1

Oh haha! I see what happened! Silly me. Thanks!

0

No problem! haha

0

You should always click Accept Answer under my name on the question if it helped. Thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.