Problems with my ability

I made a ability that works fine, however I wanted to make it rotate toward the mouse when I hold the ability key, with help I achieved this, then I realized that for some reason when I used my ability and aimed with the mouse, the ability wouldn’t go where it was supposed to go?

Example: I hold the ability key down, and I use my mouse to aim at a dummy, the move doesn’t go in the rotated direction, but it goes in the direction I was in when I first clicked the ability key?
I thought it was cause the rotating was handled in the client, a valid assumption, but when I removed the mouse rotate script and rotated with shiftlock it still did the same thing?
so its not to do with the mouse rotate script?

Video to show

TLDR move doesn’t rotate when key is held

also this isn’t to do with the blocks rotating script where it rotates with the humanoid root parts rotation

2 Likes

Can you show the part of your code where the input is received by the server?

local remote = script.Parent.Parent.RemoteEvent
local replicated =  game:GetService("ReplicatedStorage")
local module = game.ReplicatedStorage.module
local ragdoll = require(module.Ragdoll)

remote.OnServerEvent:Connect(function(player, char, tool)
	print("Server Recieved Call From Client . . . Initiating")

	local explosion = replicated.FX.BasicForwardHitbox:Clone() -- VFX Hitbox

	local hrp = char:WaitForChild("HumanoidRootPart")

	explosion.Parent = workspace

	explosion.CFrame = CFrame.new((hrp.CFrame*CFrame.new(0, 0, 0)).Position)

	hrp.Anchored = true



	local dir = char:GetPivot().Position + char:GetPivot().LookVector -- remove these two lines to-
	explosion:PivotTo(char:GetPivot() + char:GetPivot().LookVector * 5) -- make it not spawn infront of player (I reccomend removing them for explosions)

	local hitList = {}
1 Like

This is odd, can you also show the client script?

UIP.InputBegan:Connect(function(Input, GPE)
	if GPE then return end
	if Input.KeyCode == Enum.KeyCode.E and Debounce == 1 and toolquip == true then
		print("Local Script Recieved Input . . .")
		Debounce = 2
		spawn(function()

		ic = true
		wait(0.41)
		ic = false
			
		end)
		root.Anchored = true
		track:Play()
		wait(0.15)
		track:AdjustSpeed(0)
	end
end)

UIP.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.E and Debounce == 2 then
		repeat wait() until ic == false
		print(". . . Sending To Server")
		track:AdjustSpeed(1)
		Debounce = 3
		Remote:FireServer(char, player, UIP, tool)
		print(". . . SENT . . .")
		wait(4) -- cooldown
		Debounce = 1
	end
end)

I think the problem here is that the input is received but it takes too long to fire the remote even. You should refactor the client input system, prioritizing firing the server before the animation.

changed it to this:

UIP.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.E and Debounce == 2 then
		repeat wait() until ic == false
		print(". . . Sending To Server")
		Remote:FireServer(char, player, UIP, tool)
		track:AdjustSpeed(1)
		Debounce = 3
		print(". . . SENT . . .")
		wait(4) -- cooldown
		Debounce = 1
	end
end)

Still not working

What is “ic”? char limit aaaaa

insta cast, if I dont have it on the anim stays on it, I researched this is the best method and I can see it being used in good ability free models so it must be the best way to achieve detecting if the ability is being tapped or held

Edit for clarity:

it has been working and solved a previous bug I had

Can you temporarily move the Remote event call into the InputBegan connection?

alright I am doing it now, but question what should this be doing?

I did but its doing as expected, as soon as I hold the key down if activates the move

Are you still having the latency issue?

well I cant tell as it doesn’t do the holding thing?
my goal is to make it aim where I am looking when Im holding the key down, but this wont work if as soon as I hold it, it fires the move, not achieving my goal and also not allowing me to tell if it helped cause it didn’t

I was trying to find out if there was a delay on the server, it doesn’t seem like it though. You are probably moving too fast after the remote event call so it doesn’t update.

EDIT: I think I figured it out, give me a second.

You are anchoring the Root part here. That means that the client is unable to rotate the character. Try removing that line.

it works good, but how do I achieve it anchoring? without… anchoring it?

You need an AlignPosition constraint. You have to set it’s target position property to the Root parts position so that it can’t move but can rotate just fine.

Im a new dev and this is my first attempt at making a ability, I remember someone telling me to do this but research didn’t really explain it to me, how do I do this?