I am trying to make a proximity prompt. When you click this proximity prompt it brings up the menu to invite friends (you’ve probably seen it because it is in many other games). How do I do this?
I think it’s this what you need?
3 Likes
Since your pretty new to scripting i’ll show you how to do it from start to finish.
-
Create a RemoteEvent inside ReplicatedStorage called ‘InvitePopup’
-
Insert a normal script inside the proximity prompt.
-
Replace
print("Hello world!")
in the default script with:
local Players = game:GetService('Players')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local proximity = script.Parent
local event = ReplicatedStorage:WaitForChild('InvitePopup')
proximity.Triggered:Connect(function(player)
event:FireClient(player)
end)
-
Create a LocalScript inside StarterPlayerScripts.
-
Replace
print("Hello world!")
on the LocalScript with:
local Players = game:GetService('Players')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local SocialService = game:GetService('SocialService')
local player = Players.LocalPlayer
local event = ReplicatedStorage:WaitForChild('InvitePopup')
event.OnClientEvent:Connect(function()
SocialService:PromptGameInvite(player)
end)
I’m not sure if this works correctly.
3 Likes