#how something so simple can be confusing

1 messages · Page 1 of 1 (latest)

weak swallow
#
local makeTrash: () -> Model = function()
    print("ppa")
    local prox = Instance.new("ProximityPrompt")
    prox.MaxActivationDistance = 10
    prox.ActionText = "pick up"
    prox.HoldDuration = 1
    prox.RequiresLineOfSight = false
    --prox.Enabled = true
    
    local iPart = math.random(1, 4)
    
    local model = Instance.new("Model")
    for i = 1, iPart do
        print("part")
        local part = Instance.new("Part")
        local x = math.random(1, 3)
        local y = math.random(1, 3)
        local z = math.random(1, 3)
        if z == x then
            z = (x == 1 or x == 2) and x+1 or x-1
        end
        
        part.Anchored  = true
        part.Size = Vector3.new(x, y, z)
        part.Position = Vector3.new(math.random(0, x*0.3), y/2, math.random(0, z*0.3))
        part.Color = trashColor[math.random(1, #trashColor)]
        part.Parent = model
    end
    
    local size = model:GetExtentsSize()
    local pos = model:GetPivot()
    
    local proxPart = Instance.new("Part")
    proxPart.Anchored = true
    proxPart.CanCollide = false
    proxPart.Transparency = 1
    proxPart.CastShadow = false
    
    proxPart.Position = pos.Position + Vector3.new(0, size.Y/2+1.5, 0) 
    
    prox.Parent = proxPart
    proxPart.Parent = model
    
    print("created trash, next trigger")
    prox.Triggered:Connect(function(plr)
        print("fds")
        local scoreIntVal: IntValue = plr:FindFirstChild("scoreVal")
        print("proxtriggered", scoreIntVal)
        if scoreIntVal then print("++++1") scoreIntVal.Value += 1 end
        
        model:Destroy()
    end)
    
    return model
end
#

it wont even trigger

#

didnt even print fds

fleet kraken
#

What’s the problem

flint dew
#

Are you firing the function?

#

Why would it trigger without any events

#

U didn't call the function bassicaly

weak swallow