I want to know a bit of knowing how to stop a remotefunction not able to disconnect if i press a E then after that i press 0 I am having this trouble because when i press E then after i press 0. when the 0 keybind script doesnt have ServerInvoke() it just make my remotefunction still on while is not disconnecting, ???
Keybind E Local scripts:
local UIS = game:GetService("UserInputService") local debounce = true local plr = game.Players.LocalPlayers UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E and Debounce == true then Debounce = false script.Ora:InvokeServer() wait(3.2) Debounce = true end end)
RemoteFunction OnServerInvoke scripts:
local HandleBlade = script.Parent.Parent.Parent.Parent.Handle.Handle local hT local dmg = 3 script.Parent.OnServerInvoke = (function() hT = HandleBlade.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then hit.Parent.Humanoid:TakeDamage(dmg) end wait(1) if lhT then lhT:Disconnect() end end) end)
0's LocalScripts:
repeat wait() until game.Players.LocalPlayer k = game.Players.LocalPlayer:GetMouse() k.KeyDown:connect(function(key) if key == "0" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 20 end end) k.KeyUp:connect(function(key) if key == "0" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 end end)
I believe that the problem is from nothing being returned. In the OnServerInvoke script, you must return something for the invoke, otherwise the function will be sort of stuck. If you don't need a response, you should really use a remote event. You must return something, even if it is nothing proper. I think you should use remote event.