Can someone pls help me review this code
local debounce = false
local TouchedPart = script.Parent
local Players = game:GetService(“Players”)
TouchedPart.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
local playerUI = Players:GetNameFromUserIdAsync(player.Name)
if player and debounce == false then
debounce = true
local PlayerImage = TouchedPart.PlayerImageGui:Clone()
PlayerImage.Parent = TouchedPart
PlayerImage.ImageLabel.Image = Players:GetUserThumbnailAsync(playerUI, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
wait(1)
debounce = false
end
You didn’t receive the player userid because playerUi will always return nil. This is because your doing GetNameFromUserIdAsync. Instead you should try doing this:
When you have code that isn’t working, #help-and-feedback:scripting-support would be more applicable. Additionally, when a reply is the solution you needed, please make sure to mark it as such.