#what am i doing wrong?

1 messages · Page 1 of 1 (latest)

flint linden
#
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?

sick light
#

Is this the full script?

#

If not it lacks the function to turn it off.

#

Also you did not say what's the exact issue.

#

Is it not working entirely or something?

flint linden
#

and yes this is the entire script

#

just havent added that part yet, wanted to make sure it atleast works lol

sick light
flint linden
#

aswell as the serverside part