Ad
Log in to vote
0

Welds are not welding to Player. What is wrong with this script? [SOLVED]

Asked by 14 days ago
Edited 14 days ago

My welds don't do anything when I create them in a script but when I change their properties in the explorer while playing the game, they work perfectly. What do I need to do in order to make this work because I am very confused. It outputs no errors and the script runs perfectly creating both welds and assigning their properties.

function TestService:Spawn(Player, Weapon)
    if Weapon ~= Items.IDArray[Weapon] then
        game.ReplicatedStorage.SuccessMessage:FireClient(Player, "? Successfully found "..Weapon.." with ID "..Items.IDArray[Weapon].ID)

        -- Welding
        local WeaponSaid = game.ReplicatedStorage[Weapon]
        local Fake = WeaponSaid:Clone()
        Fake.Parent = game.Workspace[Player.Name]
        local WeldC0 = Instance.new("Weld", Fake.Model.Handle)
        local WeldC1 = Instance.new("Weld", game.Workspace[Player.Name]["Right Arm"])
        WeldC0.Name = "FakeHandle" 
        WeldC1.Name = "PlayerHandle"

        wait(0.5)
        Fake:SetPrimaryPartCFrame(CFrame.new(game.Workspace[Player.Name]["Right Arm"].Position))
        WeldC0.Part0 = WeaponSaid.Model.Handle
        WeldC0.Part1 = game.Workspace[Player.Name]["Right Arm"]

        wait(0.5)
        Fake:SetPrimaryPartCFrame(CFrame.new(game.Workspace[Player.Name]["Right Arm"].Position))
        WeldC1.Part0 = WeaponSaid.Model.Handle
        WeldC1.Part1 = game.Workspace[Player.Name]["Right Arm"]

        Fake:SetPrimaryPartCFrame(CFrame.new(game.Workspace[Player.Name]["Right Arm"].Position))
    else
        game.ReplicatedStorage.ErrorMessage:FireClient(Player, "? Sorry, I couldn't find "..Weapon.." in my Array!")
    end
end
0
Also tried debug info and it prints fine. iiMxtt_Destinyii 58 — 14d
0
Try WeldConstraint instead of Weld ezkatka1 50 — 14d
0
also here at line 16 you are setting Part0 to WeaponSaid.Model.Handle ( thats inside replicated storage tho try setting it for Fake.Model.Handle) ezkatka1 50 — 14d
0
Alright, thanks. I'll try that. iiMxtt_Destinyii 58 — 14d
View all comments (3 more)
0
Yep, that has fixed it thanks. iiMxtt_Destinyii 58 — 14d
0
Okey you can make it answered down below so poeple know its fixed! ezkatka1 50 — 14d
0
Also if you can give me Reputation i would appreciate it! ezkatka1 50 — 14d

1 answer

Log in to vote
1
Answered by 14 days ago

Answered!

Ad

Answer this question