I’m currently trying to make an ability for a project I’m working on, and I ran into this huge issue while testing:
So the ability activated when you press the B keybind, and then a part with a click detector appears infront of you and you have to click it in a time frame of 0.5s for the ability to activate. When the click detector is clicked, it fires the remote to the client and then the client fires another remote to the server that is the actual ability. This script works the first time around but then afterwards all you have to do is press B and it does everything for you, which is obviously bizarre
I’ve tried using a local value named “Pressed” and used mouse.Button1Down to activate it and Button1Up to deactivate it in one script:
I’ve even tried making it so you have to press B again in the time slot to fire the attack and it still has the same issue.
If anyone knows what’s causing this issue, please let me know lol, I’m starting to think this might be an actual roblox issue.
(If you need more screenshots or explanations ask down below aswell.)
First screenshot is the local script that fires the actual ability event once it receives the click, second screenshot is the click detector function where it detects the click, third screenshot is part of the server script. It detects when you’re allowed to click (the remote fired in screenshot four) and when you’ve clicked (remote fired in screenshot 1) sorry for not putting them in chronological order.
You shouldn’t really be firing the client to then fire the server, if server to server communication is necessary then you should make use of a BindableEvent instead, however for this scenario you should likely contain everything inside the same server script (this will cut down on observed latency & allow you to manage all of the code better).
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input and Input.KeyCode == Enum.KeyCode.B and Player.Character.Humanoid.FloorMaterial ~= Enum.Material.Air and CD == false then
spawn(function()
CD = true
wait(CDT)
CD = false
end)
game.ReplicatedStorage.Remotes.BlackFlash:FireServer("BF", Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2).p)
end
end)
Yeah, I’m gonna move the mouse click function to the server script where everything else is for the sake of it not being so messy lmao, it was like 4am when I was working so I was really sloppy and messy my bad.
Fixed my issue. There’s probably multiple ways to fix this but I just made it so it also places a click value inside the player when you click the click detector part and the script returns if you don’t have the value inside of you, so imma go ahead and write this problem off as resolved, thanks for everyone who contributed’s time.