You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I am making an F to unlock mouse script.
What is the issue? Include screenshots / videos if possible!
Even if I press F, my mouse is still locked at the middle of the screen.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The script is in starter GUI and also as a LocalScript.
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
if script.Parent.MouseUnlock.ImageButton.Visible == false then
script.Parent.MouseUnlock.ImageButton.Visible = true
else
script.Parent.MouseUnlock.ImageButton.Visible = false
end
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
I remember solving this some time ago. What you have to do is make the .Modal BoolValue turn to true. This will unlock the mouse. Setting it to false will lock the cursor again.
The texbutton’s Visible property has to be true at all times and that the TextButton takes up the entire screen. If that does not fix your issue, the topic I linked has the exact setup and code for it to work.