Hey so im trying to make the player collect points but touching a part. and i want to make a part in the player grow every 10 points. and for now i’ve made the code only if the value is bigger than 10 just to test it but it doesnt work for some reason. i would really like some help here. thanks!
There is no error msg if anyone is asking
local part = script.Parent
local value = math.random(1,4)
local function onTouch(otherPart)
local hum = otherPart.Parent:FindFirstChild('Humanoid')
if hum then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player then
otherPart = player:FindFirstChild("TouchPart")
player.leaderstats.Points.Value = player.leaderstats.Points.Value + value
part:Destroy()
if(player.leaderstats.Points.Value > 10) then
local DigPart = player:FindFirstChild("Dig")
if DigPart then
DigPart.Size = Vector3.new(10, 3, 10)
end
end
end
end
end
part.Touched:Connect(onTouch)