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
I ended up fixing the problem.
Here is the working code:
local Player = game:GetService("Players").LocalPlayer local UI = game:GetService("UserInputService") Player.CharacterAdded:Connect(function(char) local Humanoid = char:WaitForChild("Humanoid") UI.MouseIconEnabled = true end)
Thanks to @CodeAddict and @incapaz for the help, I appreciate it!