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

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

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)

1 comment

0

i edited my question to answer your "how to i make this server-sided" question

1 answer

✓ Accepted answer

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)

6 comments

0

Wow! thanks so much!

0

Question: How can I make the script server-sided?

1

what i did was tool.parent.parent.character

0

Wydm "tool.parent.parent.Character"?

0

You have a point TheDude646

0

Thanks so much!

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