I need help with this script because I want it to only give 1 point and not 5 because it touches other body parts of the players character.
local triggerPart = script.Parent
local targetPart = game.Workspace:FindFirstChild(“TpTo”)
triggerPart.Touched:Connect(function(hit)
local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player and targetPart then
-- Teleport the player
character:SetPrimaryPartCFrame(targetPart.CFrame)
-- Add 1 score to the leaderstats
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local score = leaderstats:FindFirstChild("Score")
if score then
score.Value = score.Value + 1
end
end
end
end)