How do I give a tool a E to use ability script?

Run it from the server perspective cuz client changes do not replicate. basically go to Test → Server and then run the cmd in cmd bar

That’s what I did, I used this command bar
image

Did you run it while playing as the client i.e the player?

Yes, I ran it while playing as the player.
It worked! For some reason, it didn’t work in Test.

edit: yeah you didnt need me i didnt read the rest of the replies lol
you can move the use a remote event to trigger the golbal script from the local script.
(my script might n ot work bc im bad but i think you can fix the errors)
local script:

local event = script.Parent.RemoteEvent

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		event:FireServer()
	end
end)

global script:

local Tool = script.Parent
local Player = script.Parent.Parent.Parent
local Character = Player.Character
local Humanoid = Character.Humanoid
local HitScript = Tool.HitScript
local UIS = game:GetService("UserInputService")
local event = script.Parent.RemoteEvent
-- Ball
local Ball = script.Parent.DefaultBall
local character = Tool.Parent
-- Animation
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://13962251515"
-- Settings
local debounce = false -- Cooldown
Animation.Parent = Humanoid.Animator
local UIS = game:GetService("UserInputService") -- We do this so we can get the players inputs
local debounce = false

RemoteEvent..OnServerEvent:Connect(function()
Humanoid.Health += 15
end)

Tool.Activated:Connect(function(activated)
	local HitAnimPlay = Humanoid:LoadAnimation(Animation)
	if not debounce then
		debounce = true
		HitAnimPlay:Play()
		HitScript.Enabled = true
		wait(2)
		HitScript.Enabled = false
		debounce = false
	end
end)
1 Like

Thank you! I just have to find out how to use debounce for it, because when I tried using debounce it didn’t work and it is able to be spammed

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.