I have a game that uses rounds which utilizes the :LoadCharacter() method. During these rounds, players are given weapons to fight. However, at the end of the round whenever the :LoadCharacter() method is called to end the round and the players respawn while holding a weapon, their mouse icons are invisible. I attempted to fix this using this script:
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if Humanoid then
Humanoid.Died:Connect(function()
UserInputService.MouseIconEnabled = true
end)
end
end)
end)
However, this uses the Humanoid.Died function, which doesn't help me in this situation, and I am unsure on how to go about this while using :LoadCharacter()
I would appreciate any help leading to fixing this!
Thank you

5 comments
The code you provided should not work as it's on the client. PlayerAdded is fired before the client scripts are loaded in (in most of the cases.) Therefore you should just do the .CharacterAdded event or so. Do that and post results here
I decided to go with this due to your comment. https://www.robloxdev.com/api-reference/event/Player/CharacterAdded and used the "Detecting Player Spawns and Despawns" sample and added in the local UserInputService and set it to true in the onCharacterAdded function. It prints when the player spawns and despawns, however, it still doesn't show the mouse icon.
Additionally UserInputService does not exist on the server
TheOddyssey, i may fix it
Ok and there is however no problem with it when i just tested it in studio and