Another thing I should add is that:
The player’s character can sometimes be dead or not yet initialized once the function is called, so I would modify:
local Character = player.Character or player.CharacterAdded:Wait()
The or
operator switches to value2 when value1 is nil or false.