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
5 years ago
Edited 5 years ago

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

01local player = game.Players.LocalPlayer
02local repStorage = game.ReplicatedStorage
03local playerChar = player.Character or player.CharacterAdded:Wait()
04 
05local function activate()
06    if not playerChar:FindFirstChild("BackSword") then
07        playerChar.HandSword:Destroy()
08        repStorage.SwordBack:FireServer()
09    elseif playerChar:FindFirstChild("BackSword") then
10        playerChar.BackSword:Destroy()
11        repStorage.Sword:FireServer()
12    end
13end
14 
15game:GetService("UserInputService").InputBegan:Connect(function(input, isTyping)
16    if isTyping then return end
17    if input.KeyCode == Enum.KeyCode.One then
18        activate()
19    end
20end)

ServerScript:

01local Swprd = game.ServerStorage.HandSword
02local repStorage = game.ReplicatedStorage
03local remote = repStorage.Sword
04 
05remote.OnServerEvent:Connect(function(plr)
06    local SS = Swprd:Clone()
07    local weldPart = SS.WeldPart
08    local char = plr.Character or plr.CharacterAdded:Wait()
09    local LH = char.WeldPart
10    SS.Parent = char
11    local weld = Instance.new("Weld", char)
12    weld.Name = "Welder"
13    weld.Part0 = LH
14    weld.Part1 = weldPart
15    weld.Parent = weldPart
16end)
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 — 5y
0
Sorry but it doesn't seem to work @Friskyman321 Shubu13 29 — 5y

Answer this question