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

When I reset I cannot re-quip my weapon, Am I doing something wrong?

Asked by
Shubu13 29
4 years ago
Edited 4 years ago

So whenever I reset I get the BackSword Welded just fine but I cannot Equip after reseting/dying Local Script:

local player = game.Players.LocalPlayer
local repStorage = game.ReplicatedStorage
local playerChar = player.Character or player.CharacterAdded:Wait()

local function activate()
    if not playerChar:FindFirstChild("BackSword") then
        playerChar.HandSword:Destroy()
        repStorage.SwordBack:FireServer()
    elseif playerChar:FindFirstChild("BackSword") then
        playerChar.BackSword:Destroy()
        repStorage.Sword:FireServer()
    end
end

game:GetService("UserInputService").InputBegan:Connect(function(input, isTyping)
    if isTyping then return end
    if input.KeyCode == Enum.KeyCode.One then
        activate()
    end
end)

ServerScript:

local Swprd = game.ServerStorage.HandSword
local repStorage = game.ReplicatedStorage
local remote = repStorage.Sword

remote.OnServerEvent:Connect(function(plr)
    local SS = Swprd:Clone()
    local weldPart = SS.WeldPart
    local char = plr.Character or plr.CharacterAdded:Wait()
    local LH = char.WeldPart
    SS.Parent = char
    local weld = Instance.new("Weld", char)
    weld.Name = "Welder"
    weld.Part0 = LH
    weld.Part1 = weldPart
    weld.Parent = weldPart
end)
0
i think the error is at line 17 on local script, try adding ONE on input.Keycode like this: if input.KeyCode.One == Enum.KeyCode.One      hope it helped u. Edit: if its not working im sorry, im just a noob scripter Friskyman321 121 — 4y
0
Sorry but it doesn't seem to work @Friskyman321 Shubu13 29 — 4y

Answer this question