Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool weld with a workspace part?

Asked by 5 years ago

I did a gun with a shield,but the shield doesn't stop the bullets,and my solution was welding a invisible part of workspace to the riot tool,i did that script,but it's not working!:< It's a normal script inside the tool

local prev 
local parts = workspace.Part
for i = 1,#parts do 
if (parts[i].className == "Part") then 
if (prev ~= nil)then 
local weld = Instance.new("Weld") 
weld.Part0 = prev 
weld.Part1 = parts[i] 
weld.C0 = prev.CFrame:inverse() 
weld.C1 = parts[i].CFrame:inverse() 
weld.Parent = prev 
end 
prev = parts[i] 
end 
end 
wait(3) 
script:remove()
0
this is a free model User#24403 69 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

What you did wrong is that you INVERSE Nothing so they doesnt get stuck to each other to fix this you need to Inverse them

local prev 
local parts = workspace.Part
for i = 1,#parts do
if (parts[i].className == "Part") then
if (prev ~= nil)then
local weld = Instance.new("Weld") 
weld.Part0 = prev 
weld.Part1 = parts[i]
weld.C0 = prev.CFrame:inverse() *parts[i]
weld.Parent = prev 
end
prev = parts[i]
end
end
wait(3) 
script:remove()

I hope I helped you :D

0
Not working. SpringtraPlayer 16 — 5y
Ad

Answer this question