So currently I’m trying to make special skills for my combat system in my game, and for some reason the script works, but doesn’t at the same time, I know this might sound weird but its true i promise you! Alright so here’s the weird errors that I am getting
But here is proof that the script actually works
https://gyazo.com/a8e05cdd182fd3af1a7821836b991822
I’ve made it using a local script that is inside the tool that sends to the server script the enemy player, their humanoid root part and their humanoid using a remote, here is a chunk of the local script
UIS.InputBegan:Connect(function(input,gameprocessed)
if input.KeyCode == Enum.KeyCode.X and active == true then
-- if debounce2 == true then
-- return
-- end
if debounce2 == false then
debounce2 = true
local Players = game:GetService('Players')
for _,Player in next, Players:GetChildren() do
local character = Player.Character
if character and character.Parent and Player ~= player then
local eHumRP = character.HumanoidRootPart
local eHum = character.Humanoid
local eChar = character
local Magnitude = (player.Character.HumanoidRootPart.Position - character.HumanoidRootPart.Position).magnitude
local Humrp = char:FindFirstChild('HumanoidRootPart')
if Magnitude <= 10 then
smashEvent:FireServer(char, eHum, eHumRP, eChar)
end
else
smashEvent:FireServer(char)
end
end
end
end
end)
end)
and here is the the server side script
local RP = game:GetService('ReplicatedStorage')
local Smash = RP.CombatRemote:WaitForChild('Smash')
local Heavy = RP.CombatRemote:WaitForChild('Heavy')
Heavy.OnServerEvent:Connect(function(Player,Char, eHum, eHumRP, eChar)
local Humrp = Char:FindFirstChild('HumanoidRootPart')
local Hum = Char:FindFirstChild('Humanoid')
end)
Smash.OnServerEvent:Connect(function(Player,Char, eHum, eHumRP, eChar)
local Humrp = Char:FindFirstChild('HumanoidRootPart')
local Hum = Char:FindFirstChild('Humanoid')
eHumRP.CFrame = eHumRP.CFrame * CFrame.new(0,2,0)
eHum:TakeDamage(10)
end)
Please someone help me with this problem because I have no idea what i’m supposed to do in order to fix it