You can write your topic however you want, but you need to answer these questions:
I am trying to make a JoJo game, and with that I need to be able to run a attack only when the Stand is equipped. I’ve been trying to do So for About a hour.
So Far I’ve tried running loops, only firing when the mouse button is clicked, the basics.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local mouse = game.Players.LocalPlayer:GetMouse()
local debouce = false
local isActive = false
local cd = 4
mouse.Button1Down:Connect(function()
if debouce == false and isActive == false then
debouce = true
isActive = true
if isActive == true then
print("Stand Is Equipped and Ready to attack")
else
print("Please Equipt Stand To Attack")
end
end
end)
The RE is going to be used in the future, I need to get this local script working first.
You are missing an if statement for checking if the player is equipping the tool.
local tool = -- Define tool here
local mouse = game.Players.LocalPlayer:GetMouse()
local debouce = false
local cd = 4
mouse.Button1Down:Connect(function()
if debouce == false then
debouce = true
if tool.Equipped == true then
print("Stand Is Equipped and Ready to attack")
else
print("Please Equipt Stand To Attack")
end
wait(cd)
end
end)
Yes, using a bool value will work with this script:
local value = -- Define BoolValue here
local mouse = game.Players.LocalPlayer:GetMouse()
local debouce = false
local cd = 4
mouse.Button1Down:Connect(function()
if debouce == false then
debouce = true
if value.Value == true then
print("Stand Is Equipped and Ready to attack")
else
print("Please Equipt Stand To Attack")
end
wait(cd)
end
end)
local mouse = game.Players.LocalPlayer:GetMouse()
local holding = false
mouse.Button1Down:connect(function()
if holding == true then
-- run code here
end
end)
script.Parent.Equipped:connect(function()
holding = true
end)
script.Parent.Equipped:connect(function()
holding = false
end)
By the way, this has to be in a localscript inside the tool.