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

Trying to make a dash tool for the morph, but It keeps saying "Torso Is not a valid member of" (?)

Asked by 1 year ago

Hello!

I made a tool Inside an NPC that when activated causes the NPC to dash, basically, the reason why the tool Is Inside the NPC Is because I made a tool that lets you morph or transform Into that said morph, the problem Is that when I activate the ability, It does literally nothing, and the output said:

Torso is not a valid member of Backpack "Players.imnotaguest1121.Backpack"

I did the same thing before and It worked, I don't know why Its happening on this one though

(Note: The script Is unfinished, you don't need to add the dashing part, just fix why Its not working)

Script

 local Tool = script.Parent
local Troll = Tool.Parent
local Debounce = false

Tool.Activated:Connect(function()
    if not Debounce then
        Debounce = true
        Troll.Torso.Anchored = true
        wait(1)
        Debounce = false
        Troll.Torso.Anchored =  false
    end
end)
0
i edited my question to answer your "how to i make this server-sided" question Xapelize 2658 — 1y

1 answer

Log in to vote
1
Answered by
Xapelize 2658 Moderation Voter Community Moderator
1 year ago
Edited 1 year ago

When the tool is unequipped, Tool.Parent is the backpack; when the tool is equipped, Tool.Parent is the character model.

Fortunately, there is an alternative solution to get the character: by doing game.Players.LocalPlayer.Character.

Fixed script:

 local Tool = script.Parent
local Character = game.Players.LocalPlayer.Character
local Debounce = false

Tool.Activated:Connect(function()
    if not Debounce then
        Debounce = true
        Character.Torso.Anchored = true
        wait(1)
        Debounce = false
        Character.Torso.Anchored =  false
    end
end)

To make this script server-sided, try using this method to get the character: Tool.Parent.Parent.Character.

 local Tool = script.Parent
local Character = Tool.Parent.Parent.Character
local Debounce = false

Tool.Activated:Connect(function()
    if not Debounce then
        Debounce = true
        Character.Torso.Anchored = true
        wait(1)
        Debounce = false
        Character.Torso.Anchored =  false
    end
end)
0
Wow! thanks so much! imnotaguest1121 362 — 1y
0
Question: How can I make the script server-sided? imnotaguest1121 362 — 1y
1
what i did was tool.parent.parent.character TheDude646 72 — 1y
0
Wydm "tool.parent.parent.Character"? imnotaguest1121 362 — 1y
View all comments (2 more)
0
You have a point TheDude646 Xapelize 2658 — 1y
0
Thanks so much! imnotaguest1121 362 — 1y
Ad

Answer this question