Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to change connect so instead of touching an object, you have to left click then touch? [closed]

Asked by 2 months ago
axelvl = 1 --Damage to ore.
allyWood = 5 --Money from ore.
resettime = .5 --Wait time for reuse.

Tool = script.Parent
ting = 0 --Debounce.

function hit()
    print("hitting")
end

function onActivated() 
    if not Tool.Enabled then
        return
    end
    Tool.Enabled = false
    wait(1)
    Tool.Enabled = true
end 

function onTouched(hitt)
    if ting == 0 then
    ting = 1
    if hitt.Parent.Name == "Ore" then
    user = game.Players:findFirstChild(Tool.Parent.Name)
    hitt.Parent.hit.Value = hitt.Parent.hit.Value - axelvl
    script.Parent.Handle.SwingThree:Play()
    if hitt.Parent.hit.Value < 1 and hitt.Parent.Timber.Value == 0 then
        user.leaderstats.Frang.Value = user.leaderstats.Frang.Value + allyWood
        hitt.Parent.Timber.Value = 1
        script.Parent.Handle.EndSwing:Play()
        wait(resettime)
    else
        wait(1)
    end
    end
    ting = 0
    end
end

Tool.Activated:connect(onActivated)
connection = Tool.Blade.Touched:connect(onTouched)
0
If you wish, you can fire a remoteevent that the tool interprets, and checks if the player is left clicking or not. Fifkee 924 — 2mo

Closed as Not Constructive by hiimgoodpack, Prestory, and alphawolvess

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?