I’ve been trying to establish communication between a serverscript and a localscript to prompt the gamepass purchase screen if the player doesn’t own the gamepass, however I got no idea about how to do that. Serverscript checks if the player owns a gamepass or not, and if the player doesn’t own the gamepass then I want the serverscript to somehow communicate with the localscript, so that I can prompt purchase screen. Any help would be much appreciated.
Can you give an example, because I’m not really experienced with remote events other than the :FireServer(). I tried using :FireClient(), but I think they work differently.
--ServerScript
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local CountdownLenght = 60
local Player = game.Players:WaitForChlid("BenMactavsin") --Normally you don't create variable in round countdown but I did for example's sake.
while CountdownLenght > 0 do
wait(1)
CountdownLenght -= 1
RemoteEvent:FireClient(Player, CountdownLenght) --Normally you would use :FireAllClients() in a round countdown like this one but I used :FireClient() for example's sake again.
end
--LocalScript
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local Label = script.Parent.Frame.TextLabel
RemoteEvent.OnClientEvent:Connect(function(Counter)
Label.Text = tostring(Counter)
end)