I have a LocalScript that contains a Script and 2 RemoteEvents, first is called "Equip" and second is called "UnEquip." I have tried moving the events and the Script to multiple places, ReplicatedStorage, ServerStorage, Lighting even. The LocalScript fires the Equip event when the key "f" is clicked and then in the Script, it should find a model of a Sword in ReplicatedStorage and weld it to the Player's hand. I have found that the problem isn't to do with the LocalScript, I believe it is just a problem with the Script because everything in the LocalScript still runs smoothly and fine. I also went into the normal Play testing in Studio just to see if it worked there, and it does, it just won't work in online servers.
Here is my code:
LocalScript:
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local mouse = Player:GetMouse()
local Equipped = false
local UsedOnce = false
game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.F and Equipped == false and UsedOnce == false then
---Etc, etc, etc
script:WaitForChild("Equip") --Have tried it without WaitForChild as well
script.Equip:FireServer()
end)
Script:
UsedOnce = false
Equipped = false
script.Parent.Equip.OnServerEvent:Connect(function(Player)
if Equipped == false and UsedOnce == false then
wait()
Equipped = true
Staff = game.ReplicatedStorage.Weapons.Sword:Clone()
Staff.Parent = Player.Character
Staff:SetPrimaryPartCFrame(Player.Character.LeftHand.CFrame*CFrame.new(0, -0.15, 0))
Staff:SetPrimaryPartCFrame(Staff.Handle.CFrame*CFrame.Angles(math.rad(90), 0, math.rad(90)))
Welder = Instance.new("WeldConstraint")
Welder.Parent = Staff.Handle
Welder.Part0 = Staff.Handle
Welder.Part1 = Player.Character.LeftHand
----------------------------------------------------------
elseif Equipped == false and UsedOnce == true then
wait()
Equipped = true
WelderBack:remove()
Staff:SetPrimaryPartCFrame(Player.Character.LeftHand.CFrame*CFrame.new(0, 0, 0.2))
Staff:SetPrimaryPartCFrame(Staff.Handle.CFrame*CFrame.Angles(math.rad(-90), math.rad(45), 0))
WelderHand = Welder:Clone()
WelderHand.Parent = Staff.Handle
WelderHand.Part0 = Staff.Handle
WelderHand.Part1 = Player.Character.LeftHand
end
end)
script.Parent.UnEquip.OnServerEvent:Connect(function(Player)
if UsedOnce == false then
Welder:remove()
elseif UsedOnce == true then
WelderHand:remove()
end
wait()
Staff:SetPrimaryPartCFrame(Player.Character.LowerTorso.CFrame*CFrame.new(1, 0.5, -2))
Staff:SetPrimaryPartCFrame(Staff.Handle.CFrame*CFrame.Angles(math.rad(25), math.rad(90), 0))
Staff:SetPrimaryPartCFrame(Staff.Handle.CFrame*CFrame.fromOrientation(math.rad(90), 0, 0))
WelderBack = Welder:Clone()
WelderBack.Parent = Staff.Handle
WelderBack.Part0 = Staff.Handle
WelderBack.Part1 = Player.Character.LowerTorso
UsedOnce = true
Equipped = false
end)
Please, any help?

5 comments
have you checked the server log in the online game
if you mean the Output the yes I have.
There were no errors
Where is the script located? If it's located under the localscript, where is the localscript located?
The script is located inside the localscript and the localscript is inside the players backpack, the 2 remote events are located inside the localscript as well, I needed to do that instead of putting them in ReplicatedStorage because they would break when i put them in ReplicatedStorage.