local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local FocusedEvent = ReplicatedStorage:WaitForChild("FocusedEvent")
UserInputService.WindowFocused:Connect(function()
player:SetAttribute("Focused", true)
FocusedEvent:FireServer(true)
print(player.Name .. " is focused.")
end)
the goal is when the player first join the game and actually tabs in or shows activity, i want their attribute to be set to focused (if tabbed out it causes map to bug out and not fully load at first) i have a serverside script that listens for the focused event and sets the attribute serverside aswell, how can i make this actually work?