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

My weld isn't appearing in the game?

Asked by 4 years ago

Happy new years! I'm starting off this year with an endless problem in my welding. For some reason, it physically doesn't show up. The part nor the weld does not appear on the player (It's a Sword) along with it not even showing up in workspace. There's probably one thing that the local script can't see, or one thing that's placed in the wrong area, but I have no idea what is wrong with this.

I am doing this through a Event Fire, in which the event is in Replicated Storage. The first script (local script) works fine, but the second script (server script) that does all the welding does not.

-Local script, in StarterPack

wait(2)

local plr = game.Players.LocalPlayer
local class =  plr.leaderstats.class
local event = game.ReplicatedStorage.ClassData.Bloxxer.BWeld
local event2 = game.ReplicatedStorage.ClassData.Bloxxer.BDelete
local b = script.Parent
if event then
    print("ok")
end
if class.Value == 1 then
    event:FireServer(plr)
print("1 les")
end
local function makeclass()
print("1 les")
event:FireServer(plr)
plr.PlayerGui.ClassMoves.MoveSet.Visible = true
print("2 les")
b.ATTACK.ATTACK.Disabled = false

end

local function endclass()
b.Attack.Disabled = true

event2:FireServer(plr)
print("ASD")
end

class.Changed:Connect(function(class)
if class == 1 then
makeclass()

if class ~= 1 then
endclass()

end
end
end)

-Server Script, in StarterPack

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)

print("bubububub")


local event = game.ReplicatedStorage.ClassData.Bloxxer.BWeld
local event2 = game.ReplicatedStorage.ClassData.Bloxxer.BDelete

local function Connected()
    print("okok")
    local part = game.ReplicatedStorage.ClassData.Bloxxer.BloxxerSword:Clone()
        part.Name = "BSword"
    local weld = Instance.new("Weld",part)
    print("lets go lets og")
        part.Parent = plr.char
        weld.Part0 = part --Attach to the handle
        weld.Part1 = char["RightHand"] --Attach to the right hand.
        weld.C0 = CFrame.new(-8, -1, -7) + Vector3.new(0,char["RightHand"].Size.Y/1,0)
        weld.C0 = CFrame.Angles(0,math.rad(180), 140)
end

local function Connected2()

    local part = char.BSword
    part:BreakJoints()
    part.Destroy()  
end

event.OnServerEvent:Connect(Connected)
event2.OnServerEvent:Connect(Connected2)

    end)
end)

If you need any more info on the question, I can elaborate! Thanks!

Answer this question