I don't know if this is an issue or just my own unawareness. I'm trying to make my place first-person locked, but when you open up the GUI, Modal is set to True in the button, thus letting you move your mouse around as long as the GUI is still up. The problem is that when the "X" button is pressed and the GUI collapses by setting Modal to false, you can still move your mouse around freely. Am I doing something wrong? Incorrect syntax?
I have two TextButtons, alongside some TextLabels and other whatnot. One is to bring up the GUI, and the other appears on it itself.
LocalScript inside button to bring the GUI up. This is in a separate TextButton (Button), inside a different frame (Sidebar), inside the same ScreenGui (Menu), in StarterGui.
local ShopThing = script.Parent.Parent.Parent:WaitForChild("ShopThing")
local Tween = game:GetService("TweenService")
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.L then
-- Do something when L is pressed
Tween:Create(ShopThing,TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0.5,1,0,10)}):Play()
game.Lighting.Blur.Size = 15
script.Parent.Modal = true
end
end)
The "X" button to close the GUI. This is a LocalScript inside a different TextButton (Exit Button), inside a frame (ShopThing), inside a ScreenGui (Menu), in StarterGui.
local ShopThing = script.Parent.Parent.Parent:WaitForChild("ShopThing")
local Tween = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
script.Parent.MouseButton1Click:Connect(function()
Tween:Create(ShopThing,TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0.5,1,-0.15,10)}):Play()
game.Lighting.Blur.Size = 3
print("bruv")
game.StarterGui.Menu.Sidebar.Button.Modal = false
end)
Any help would be much appreciated!
Game Link: https://www.roblox.com/games/4753954002/Alley-oop?refPageId=c74eb7df-44bb-45a6-9326-fe9d35a22558

5 comments
PlayerGui.. not StarterGui...
https://scriptinghelpers.org/questions/60714/short-questionwhat-are-the-differences-between-playergui-and-startergui
so it would work if I moved this to PlayerGui?
Yes, I apologize if I come off a bit angry. This is too common of a mistake made within this forum, and I’ve responded with the same answer numerous times, you can understand it gets tedious after a while
I don't got a clue how or why that worked, but you're a lifesaver. Thank you.