The code below is suppose to return a value to the client via a remote function as the title says,
remotes.hit.OnServerInvoke = function(player,debounce,repetition)
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
if hum.Health>0 and debounce.Value == false then
debounce.Value = true
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://"..repetition.animationId
local track = hum:LoadAnimation(anim);track:Play()
local hitBox,touchedEvent
track.KeyframeReached:Connect(function(key)
if key == "Stop0" then
debounce.Value = false
end
end)
track.Stopped:Connect(function()
hitBox=hitBox and hitBox:Destroy()
touchedEvent=touchedEvent and touchedEvent:Disconnect()
end)
if not(repetition.hitBox==nil) then
hitBox=Instance.new("Part");hitBox.Name="hitBox";hitBox.Size=Vector3.new(2,2,2);hitBox.Transparency=1;hitBox.CanCollide=false
local weld = Instance.new("Weld");weld.Part0=char[repetition.hitBox];weld.Part1=hitBox;weld.Parent=hitBox
weld.Parent=hitBox;hitBox.Parent=char;
end
touchedEvent = hitBox.Touched:Connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health>0 and hit.Parent~=char then
touchedEvent:Disconnect()
if repetition.hitId then
local react = Instance.new("Animation")
react.AnimationId = "rbxassetid://"..repetition.hitId
local reaction = hit.Parent.Humanoid:LoadAnimation(react)
reaction:Play(nil,nil,2)
end
print("nani")
return true
end
end)
end
end
It, somehow, prints nani but when I try to print the returned value on the client it simply prints nil
local debounce = script.Parent:WaitForChild("States"):WaitForChild("Attack")
function process(input,gameProcessedEvent)
timeComplexity.bindable:Fire()
playSlashSound()
local hit = remotes.hit:InvokeServer(debounce,combos_chain[indexes.bigIndex][indexes.subIndex])
print(hit) --says nil...
counterManager(combos_chain[indexes.bigIndex][indexes.subIndex],hit)
end
uis.InputBegan:Connect(function(input,gameProcessedEvent)
if not gameProcessedEvent and input.UserInputType == Enum.UserInputType.MouseButton1 then
local disabledByTag = simplicity.isTagged(char,{"ice","poison","lightning"})
local bounce = remotes.request:InvokeServer(debounce)
if disabledByTag == false and bounce == true then debounce.Value = true
process(input,gameProcessedEvent)
end
end
end)