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)
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)