Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I get this to work?

( I posted about this a few hours ago but I didn't get any help.)

Ok, so what I want to do is hit a stationary object, like a non-moving brick. I want to hit it with a tool that has a script in the Handle and has the same animation as a Linked Sword. Here's the script.

enabled = true
function onTouched(h)
    if enabled == true then
        if h.Name == "PUTIS" then -- The stationary object's name that the tool will hit
            if h.Transparency ~= 1 then
            enabled = false
            h.Parent.Humanoid.Health = h.Parent.Humanoid.Health - 25 -- The stationary object has a humanoid. Whenever touched with the tool's handle, it will decrease by 25 health.
            wait(1)
            enabled = true
            end
        end
    end
end

script.Parent.Touched:connect(onTouched)

There is no output error. For some reason, the script won't do anything when I'm (the player) is stationary and hitting the stationary object. This should work since the tool is moving, allowing the Touched script to activate, but it only works when the player himself/herself is moving. I'm looking for a fix to this problem or maybe an alternative solution that doesn't include a Touched script.

1 answer

There are already answers suggested to this topic. Your statement of "I didn't get any help" seems misleading.

https://scriptinghelpers.org/questions/3060/how-would-i-get-this-to-work

Also according to the ScriptingHelpers blog you can't have duplicate posts.

3 comments

0

No one was any help was what I meant

0

And did you even bother to check the new suggestion?

0

Oh, no. I'm sorry. Thanks for the script, too. I really appreciate it.

This discussion is preserved as it was. New answers, comments, and votes are closed.