Script didn't get fired server from local script

Hi, i was making my sword combat system but i got a problem that when i fired remote event, my script didn’t do the function, i already do OnServerEvent thing can anyone help?

Here my server script

local player = game.Players.PlayerAdded
local char = script.Parent
local equipsword = false
local Debris = game:GetService("Debris")
function EquipSword()
	print("test2")
	local weaponsheat = game.ReplicatedStorage.SwordEquip.ToyakoSheat:Clone()
	local weld = Instance.new("Weld")
	local weldtorso = Instance.new("Weld")
	local weapon = game.ReplicatedStorage.Weapon.Toyako:Clone()
	if equipsword == false then
		weapon.Parent = char
		weld.Parent = weaponsheat
		weld.Part0 = weaponsheat
		weld.Part1 = char.RightArm
		weld.C0 = weld.Part0.Attachment.CFrame
		weld.C1 = weld.Part1.RightGripAttachment.CFrame * CFrame.new(-1.1, -1, 0) * CFrame.Angles(-70.5,math.rad(-180),math.rad(-180))
		equipsword = true
	elseif equipsword == true then
		print("test2")
		weaponsheat.Parent = char
		weldtorso.Part0 = weapon
		weldtorso.Part1 = char.RightArm
		weld.C0 = weld.Part0.Attachment.CFrame
		weldtorso.C1 = weldtorso.Part1.WaistFrontAttachment.CFrame * CFrame.new(-1.1, -1, 0) * CFrame.Angles(-70.5,math.rad(-180),math.rad(-180))
		equipsword = false
	end
end

game.ReplicatedFirst.EquipSword.OnServerEvent:Connect(EquipSword)

Here my local script

local UserInputService = game:GetService("UserInputService")
local function onInputBegan(input, gameProcessed)
	if input.KeyCode == Enum.KeyCode.E then
		game.ReplicatedFirst.EquipSword:FireServer()
		print("Fired sucess")
	end
end

UserInputService.InputBegan:Connect(onInputBegan)

Here where i place it

image

It’s common to keep Remote Events inside ReplicatedStorage. Maybe try this

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EquipSword = ReplicatedStorage:WaitForChild("EquipSword")
local UserInputService = game:GetService("UserInputService")
local function onInputBegan(input, gameProcessed)
	if input.KeyCode == Enum.KeyCode.E then
		EquipSword:FireServer()
		print("Fired sucess")
	end
end

UserInputService.InputBegan:Connect(onInputBegan)
1 Like

Put the remote inside Replicated STORAGE, not in replicated first, hopefully it works now:)