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
#how something so simple can be confusing
1 messages · Page 1 of 1 (latest)