hey all, I have a weapon that spawns a beam, which is supposed to attach it’s attachment to the tool’s attachment, and tween its size to become larger, except it does not attach, just welds to the tool
script:
mastersparkEvent.OnServerEvent:Connect(function()
local HakkeroBeam = ReplicatedStorage.BulletModels:WaitForChild("HakkeroBeam")
local createBeam = HakkeroBeam:Clone()
createBeam.Parent = workspace.Bullets
for i, Parts in pairs(createBeam:GetChildren()) do
if Parts:isA("BasePart") then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Handle
Weld.Part1 = Parts
Weld.Parent = Parts
end
Parts.Anchored = false
Parts.CanCollide = false
Parts.Massless = true
end
createBeam.Field.AttachPoint.CFrame = Handle.BulletPoint.CFrame
--local testsize = TweenService:Create(test,Info,Goals)
--testsize:Play()
end)
Hello @Secerne! I took your script and tried to solve your problem. Below, you can see what I did. I hope this is what you want.
mastersparkEvent.OnServerEvent:Connect(function()
local HakkeroBeam = ReplicatedStorage.BulletModels:WaitForChild("HakkeroBeam")
local createBeam = HakkeroBeam:Clone()
createBeam.Parent = workspace.Bullets
for i, Parts in pairs(createBeam:GetChildren()) do
if Parts:IsA("BasePart") then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Handle
Weld.Part1 = Parts
Weld.Parent = Parts
end
Parts.Anchored = false
Parts.CanCollide = false
Parts.Massless = true
end
createBeam.Field.AttachPoint.CFrame = Handle.BulletPoint.CFrame
--local testsize = TweenService:Create(test,Info,Goals)
--testsize:Play()
end)
Edit: The only difference is the isA to IsA. I am a newbie to scripting, but I think this is the error. If you found this answer useful, do not forget to mark it as solved .
well, i was welding it to the tool using a regular instance.new part and it was able to “attach” to the attachment point, so i assumed it would work for a model
I still need help, changing the CFrame to one of the parts in the model does absolutely nothing and removing the weld code just simply makes it not weld