What I am to achieve: I want to be able to move my mouse whenever I am on the social service UI so that players can invite their friends even in first person.
The problem: Whenever you are in first person the social service UI buttons cannot be changed to modal = true therefore does not work in first person.
Soluations tried: Since it is a core gui I do not think there are any soluations in term of setting the ui buttons to modal = true.
Here is my code:
function canSendGameInvite(sendingPlayer)
local success, canSend = pcall(function()
return SocialService:CanSendGameInviteAsync(sendingPlayer)
end)
return success and canSend
end
MainButtonsHolder2:WaitForChild("Invite").MouseButton1Click:Connect(function()
if Debounce1 == false then
Debounce1 = true
local canInvite = canSendGameInvite(plr)
if canInvite then
local success, errorMessage = pcall(function()
SocialService:PromptGameInvite(plr)
end)
end
local button = MainButtonsHolder2:WaitForChild("Invite")
SFX:WaitForChild("Interact"):Play()
uiAnimbutton(button)
Debounce1 = false
end
end)
hey! so, i get what you’re trying to do here. the problem is that the default social ui doesn’t work as expected in first-person, especially when it comes to things like buttons that need to be modal. unfortunately, because it’s a CoreGui, you can’t change the modal property directly, and that’s what’s causing issues in first-person.
but here’s the thing—there’s still a way to make this work. you can either create a custom ui or just use SocialService:PromptGameInvite(), which should still show up and work even in first-person. the modal issue only affects custom ui elements, but roblox handles the modal behavior for the game invite prompt automatically.
quick fix for your current setup that should work:
MainButtonsHolder2:WaitForChild("Invite").MouseButton1Click:Connect(function()
if not Debounce1 then
Debounce1 = true
local canInvite = canSendGameInvite(plr)
if canInvite then
local success, errorMessage = pcall(function()
SocialService:PromptGameInvite(plr)
end)
if not success then
warn("Error sending invite: " .. errorMessage) -- always use those!! so helpful!
end
end
local button = MainButtonsHolder2:WaitForChild("Invite")
SFX:WaitForChild("Interact"):Play()
uiAnimbutton(button)
Debounce1 = false
end
end)
the thing is, SocialService:PromptGameInvite() handles the invite ui for you, and it should work fine even in first-person. if you’re trying to make it so players can still interact with other ui elements, you might want to think about creating your own custom ui instead of relying on the CoreGui. that way, you can control how it behaves and make it modal however you want.
let me know if you need more info or if i can help with anything else!
Okay, so You cannot modify CoreGui, but you can change CameraMode.
so the only solution would be to Unlock Mouse While Invite UI Is Open
You need to create a new ScreenGui, insert a TextButton and make it span across the entire screen, make it transparent, remove the text, enable the ‘Modal’ property which makes it where your mouse won’t be locked in the center if your mouse is over it while zoomed in, disable the ‘Selectable’ property so you cannot interact with it on console, and then disable the ‘Active’ property so you can zoom in and out.
If you want to be able to drag your mouse around to move the camera around though, you will have to set the button in the exact center of your screen and change the size to 2x2 in offset.
That would indeed be a very good solution to this problem but sadly there is no way for me to check if the social service UI is currently visible or not therefore I cannot disable / enable this screengui since I want the player to go back into first person once they are out of the UI.
Make a keybind that unlocks the mouse, I have this in my first person game and it’s great.
I have mine bound to scroll-wheel which is what most players usually try when their mouse is stuck.
I use the same method which was suggested above. (Adding a hidden UI with modal turned on)