When i add my badge script is says "Touched is not a valid member of Model "Workspace. "" this is my script:

local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")

local Part = script.Parent
local IDToAward = 2129399776

local debounce = true

Part.Touched:Connect(function(Hit)
	local Player = Players:GetPlayerFromCharacter(Hit.Parent)
	if not Player or BadgeService:UserHasBadgeAsync(Player.UserId, IDToAward) or not debounce then
		return
	end
	debounce = false
	BadgeService:AwardBadge(Player.UserId, IDToAward)
	wait(5)
	debounce = true
end)

4 comments

0

Where is your script located

0

inside the thing im trying to touch

0

Can you do Print(Part.Name) and tell me the output?

0

Try script.Parent.Touched if your directory is being mixed up with others on accident.