Hi everyone I’m currently working on anTool Ability System and rn I want that if the Tool is activated the player should get teleport to where he looks (I hope u guys understand) there should be a cool down of 5 seconds.
Id put localscript inside the tool. Serverscript in serverscriptservice and a removeevent in replicatedstorage.
local mouse = localplayer:GetMouse() through the script.
Once tool is activated, send mouse.Hit.Position through the removeevent.
On serverscript:
remoteevent.OnServerEvent:Connect(function(player, mousepos)
player.Character:MoveTo(mousepos.Position)
end)
(not sure if this will work for 100% cuz I made it up in 5 seconds without even checking in studio)
On the client, add a cooldown boolean thats set to false. When the tool is activated check if the cooldown is false and make the cooldown true and 5 seconds laters back to false. Then fire a remote event to the server with the mouse position Player:GetMouse().Hit.Position. Then on the server make the character teleport to that position Character:MoveTo(MousePosition). You can also check the cooldown on the server if you want to to avoid exploiters.