Hello everyone! Hope you are having a nice day/night!
I have a problem. A problem with Welds and WeldConstraints.
I looked up some topics and watched some videos showing how to make welds properly but those didn’t help.
The thing is like this: I’m making a fighting game, made fists, when the player presses left click a localscript fires an event to a serverscript and that serverscript is supposed to clone a hitscan part, teleport it in front of the player’s head, parent it to the head and weld the hitscan part and the head together. But it just doesn’t want to!
As far as I know, the problem is not with the script.
This “bug” also happens with manually made welds. I just create a weld or a weldconstraint, run the game and the welds just evaporate! I also used Moon Animator’s Easy Weld plugin but that didn’t work neither. The welds just disappear when I run the game…
A section of the fists code should be down below:
tool.Equipped:Connect(function()
print("equipped")
local hum = char.Humanoid
script.Parent.hold.Value = 0
event:FireClient(player, "fist", "enable")
mouseevent.OnServerEvent:Connect(function(plr, button)
if button == "1down" then
hold.Value = "0"
while tonumber(hold.Value) ~= 1 do
hold.Value = tostring(hold.Value + 0.1)
wait(0.1)
end
elseif button == "1up" then
if tonumber(hold.Value) <= 0.3 then
print("jab")
hold.Value = "0"
local hitscan = script.Parent.hitscan:Clone()
hitscan.Parent = char.Head
hitscan.hitscanscript.Disabled = false
dmgevent:Fire(tonumber(hold.Value))
hitscan.Size = Vector3.new(4,3,2)
hitscan.Position = char.Head.Position + Vector3.new(-1.536, -0,761, 0)
--this is probably one of the weld lines where we wanna focus to
local weld = Instance.new("WeldConstraint", hitscan)
weld.Part0 = char.Head
weld.Part1 = hitscan
hold.Value = "0"
else
print("charge")
local hitscan = script.Parent.hitscan:Clone()
hitscan.Parent = char.Head
hitscan.hitscanscript.Disabled = false
dmgevent:Fire(tonumber(hold.Value))
hitscan.Size = Vector3.new(4,3,2)
hitscan.Position = char.Head.Position + Vector3.new(-1.536, -0,761, 0)
--another weld here
local weld = Instance.new("WeldConstraint", hitscan)
weld.Part0 = char.Head
weld.Part1 = hitscan
hold.Value = "0"
end
end
end)
end)
Most of the prints work, the charge system also works but as I said, the welds does not. Any help would be really appreciated.
Sincerely, Egg.