This is a snippet of a script i made but for some reason when i touch the part it wont find the humanoid. It is a server script.
–Here’s The Script
MovingTruckProp.ForceBox.Touched:Connect(function (hit)
MovingTruckProp.ForceBox.CanTouch = false
print("check")
local charHit = hit.Parent
local hum = charHit:FindFirstChild("Humanoid")
if hum then
humOption1 = hum
if #PartStoreOption1 ~= 0 and not charHit:FindFirstChild("Weld") then
local tableNumber = #PartStoreOption1
local randomNumFromTable = math.random(tableNumber)
local part = PartStoreOption1[randomNumFromTable]:Clone()
table.remove(PartStoreOption1, randomNumFromTable)
part.Parent = game.Workspace
part.Position = Vector3.new(0,20,0)
if part:FindFirstChild("WeldConstraint") then
for i, weldConstraint in pairs(part:GetChildren()) do
if weldConstraint:isA("WeldConstraint") then
weldConstraint:Destroy()
end
end
end
part.Transparency = 0
part.CanCollide = false
local weld = Instance.new("Weld")
weld.Parent = charHit
weld.Part0 = charHit.PrimaryPart
weld.Part1 = part
weld.C0 = CFrame.new(0,5,0)
partOption1 = part
weldOption1 = weld
print(part)
end
task.wait(0.7)
MovingTruckProp.ForceBox.CanTouch = true
end
end)