Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how can i make the animation play when you are holding the tool only?

Asked by 4 years ago
Edited 4 years ago

heres the local script so i want it to fire the server only if player is holding the tool

help

its a local script btw

tell me if you want the script ////////////////////////////

local Player = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")

local MaxKobosRemotes = rp:WaitForChild("MaxKobosRemotes")
local KiritoJumpSlash = MaxKobosRemotes:WaitForChild("KiritoJumpSlash")
local tool = script.Parent
local UIS = game:GetService("UserInputService")

local debounce = false
local cooldown = 7

UIS.InputBegan:Connect(function(input,isTyping)
    if isTyping then     
        return




elseif input.KeyCode == Enum.KeyCode.E and debounce == false then
    debounce = true

    KiritoJumpSlash:FireServer()



    end
end)

    KiritoJumpSlash.OnClientEvent:Connect(function()

        wait(cooldown)
        debounce = false


end)

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

you could just add an if clause surrounding the FireServer() function.

if game:GetService("Players").LocalPlayer.Character and game:GetService("Players").LocalPlayer.Character:FindFirstChildWhichIsA("Tool") then
:FireServer()
end
0
do i put it at the KiritoJumpSlash:FireServer()? themaxogamer 58 — 4y
0
its not working themaxogamer 58 — 4y
1
okay let's start off with this. who saves replicated storage in a local as rp. anyway, yes ofc you put KiritoJumpSlash he didnt feel like putting it because he prolly didnt read all the locals and figured you'd have enough brain cells to figure that out. If it still doesnt work after you fix that, then there is a problem that you did not include in the question. Heavenlyblobmaster 271 — 4y
0
man all i want to do is to make the local script fire KiritoJumpSlash:FireServer() only if players tool is equipped, then he said / FindFirstChildWhichIsA("Tool") / wich doesnt fixed anything since there could be another tool equipped now can you help me with my problem please? themaxogamer 58 — 4y
0
FindFirstChildWhichIsA("Tool") is a way of checking if a tool is equipped, you didn't mention it needed to be a specific tool. In this case you can just add another check if game:GetService("Players").LocalPlayer.Character:FindFirstChildWhichIsA("Tool") == tool then (tool being your local variable of tool, assuming it is pointing to the relevant tool object), it should work for that. centraltrains 60 — 4y
Ad

Answer this question