✓ Accepted answer
The Touched event returns the part that touched the part that the event is focusing on. For example, part1 is the part we're focusing on (touching it will trigger the Touched event). Say a player's character's left leg touches it. In your case, the variable "player" is the left leg, not the player. So, I suggest you change the "player" variable to something that makes more sense with what we're dealing with here, like "part." After you do that, you use the GetPlayerFromCharacter() method to get the player from his/her character. Your script would then look like this:
script.Parent.Touched:connect(function(part)
if part.Parent:IsA("Model") then
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
promouser((1240173),(8236279), player.userId)
end
end
end)
If this answer was helpful, please consider upvoting it and marking it as "accepted." Thanks!
2 comments
Have you define UserID? Usually that will happen if you have not perfectly define where UserID is.
Or player it could either be them.