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

I need help with a tool script for my game any out to help? (damage self script) [closed]

Asked by 4 years ago
Edited 4 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

I need help with a script, so I need to make a tool that kills you on clicking can anyone help me on that? I'm trying to add it to this :

 local Tool = script.Parent
enabled = true




function onActivated()
    if not enabled  then
        return
    end

    enabled = false
    Tool.GripForward = Vector3.new(-.981, .196, 0)
    Tool.GripPos = Vector3.new(-.5, -0.6, -1.5)
    Tool.GripRight = Vector3.new(0, -0, -1)
    Tool.GripUp = Vector3.new(0.196, .981, 0)


    Tool.Handle.EatSound:Play()

    wait(.8)

    local h = Tool.Parent:FindFirstChild("Humanoid")
    if (h ~= nil) then
        if (h.MaxHealth > h.Health + 1.6) then
            h.Health = h.Health - 1.6
        else    
            h.Health = h.MaxHealth
        end
    end

    Tool.GripForward = Vector3.new(-1, 0, 0)
    Tool.GripPos = Vector3.new(-.5, -.1, 0)
    Tool.GripRight = Vector3.new(0, 0, 1)
    Tool.GripUp = Vector3.new(0,1,0)


    enabled = true

end

function onEquipped()
    Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

[Edit by JesseSong:] Ensure you've formated your code properly by using a code block, make sure you matain your code between the lines i.e.

Your code


Also make sure you give us sufficient information to answer your question correctly. You can read this documentation by clicking on the hyperlink provided to set up a good question/answer indispensably

Also, do not put random information on the title for example( eeeeeeeeeeee) etc.

Last tip: Make sure you give us more information for us to answer your question. Simply saying "I need help" is not enough information for the community to answer your question!

Good information include: A vast description of your perception, error codes (If applicable) snippets, cross - checking (that is ways in which you've tried that failed to work) etc.

Also, always do your research before posting questions, as answers may have been answered effectively.

Thank you, JesseSong

0
Format pls User#30567 0 — 4y
0
eeeeeeeeeee WideSteal321 773 — 4y
0
Can you explain your script above?, What are you trying to do with your weapon? Reduce the player's health?? naturedat 124 — 4y

Closed as Non-Descriptive by JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?