Hi, how can I change this script so it gets the thumbnail and username from the player? I've tried a couple of times to change the coding but nothing seems to be working
local Part = script.Parent local PlayerWin = game.StarterGui.PlayerWin local PlayerName = game.StarterGui.PlayerWin.Frame.PlayerName local PlayerImage = game.StarterGui.PlayerWin.Frame.ImageLabel local thumbnail = Enum.ThumbnailType.HeadShot Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local Pic = hit.Parent.thumbnail PlayerImage.Image = Pic PlayerName.Text = hit.Parent.Name PlayerWin.Enabled = true Part:Destroy() wait(10) PlayerWin.Enabled = false humanoid.Health = 0 end end)
hit.Parent
is the character, not the player. You need to get the player. You can do this with GetPlayerFromCharacter
.
local Part = script.Parent local PlayerWin = game.StarterGui.PlayerWin local PlayerName = game.StarterGui.PlayerWin.Frame.PlayerName local PlayerImage = game.StarterGui.PlayerWin.Frame.ImageLabel local thumbnail = Enum.ThumbnailType.HeadShot Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local Pic = player.thumbnail PlayerImage.Image = Pic PlayerName.Text = player.Name PlayerWin.Enabled = true Part:Destroy() wait(10) PlayerWin.Enabled = false humanoid.Health = 0 end end)
Hope this helps
Don't forget to accept the answer if I helped!