I am having a problem that when I click on the shopkeeper, the GUI pops up but the mouse is stuck in first person. I know I'm supposed to use "modal = true" but I can't figure out what to put before the ".modal" The roblox wiki said use GuiButton.modal = true but it gives me an error when I type that.
game.Workspace["Gun Shop Owner"].ClickDetector.MouseClick:Connect(function() script.Parent.Frame.Visible = true GuiButton.Modal = true end)
here's the very short script. I'm trying to set the value to true when the Gui is pulled up and then I'll set it to false once it is closed. I can't do much until I figure this out even though it doesn't seem like it should be that hard. I'm just a bit confused about it. Can anyone fix this? thanks!
local GuiButton = script.Parent:WaitForChild("yourbuttonname") local frame = script.Parent:WaitForChild("Frame") workspace["Gun Shop Owner"].ClickDetector.MouseClick:Connect(function() frame.Visible = true GuiButton.Modal = true -- guibutton is not defined here, define guibutton out of the mouseclick function (i did it above for you, rename the string) end) --[[ notes GuiButton is a reference for both ImageButton and TextButton (saying button:IsA("GuiButton") will return true) use "workspace" as it is faster and is a global variable index your ui elements so you do not have to write script.parent.parent etc every time you need to edit or add something ]]
https://developer.roblox.com/en-us/api-reference/class/GuiButton