i am making a morph and i need the morph pad to give a tool whenever it is touched. however,i always get the error: 17:54:26.623 Players.YTFalloutDoomy.Backpack.ClassicSword.MouseIcon:27: attempt to index nil with ‘Equipped’ - Studio
here’s the script:
local item = game:GetService("ServerStorage"):WaitForChild("ClassicSword")
local db = true
script.Parent.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player ~= nil then
if player.Backpack ~= nil then
if db == true then
db = false
item:Clone().Parent = player.Backpack
wait(5)
db = true
end
end
end
end
end)
i couldn’t find any solutions to this. the script is a server-side script and it’s located in the morph pad. the tool is located in server storage.
edit: found a possible fix, the morph pad will not give the tools but other parts can. what i did is: when the player touches the pad,he gets teleported for 1 second on the pad that gives tools,then the pad disappears and the player gets teleported back.
although this is a fix,it’s not really good and i would still like some help. if this piece of info can help:
it’s an RTHRO morph
it was an old NPC i created,and to make it a morph i just removed the AI from it
to make the rig i got an rthro rig and just replaced the meshes.