Ok a quick explanation, This tool executes the "else" part if it doesn't find "PLRcrushed"
And that works, the problem is at the beginning I set "MPART" to "SampleText" but once the function is fired if the humanoid is R6 or R15 it sets "MPART" to a different string, though, it doesn't work.
The code errors and says "SampleText" is not a valid member of character, why? I'm literally setting it to a different string, Am I dumb or what am I missing
The variable is used later on the script as "plr[MPART]"
I'm pretty new to scripting tbh so sorry if the code is messy
local toolio = script.Parent
local Sounds = toolio.Handle.Sounds
local MPART = "SampleText"
function work(_,hit)
if hit:IsA("Part") or hit:IsA("MeshPart") then
if hit.Parent.ClassName ~= "Accessory" then
if hit.Parent:FindFirstChild("Humanoid") then
plr = hit.Parent
end
elseif hit.Parent.ClassName == "Accessory" then
plr = hit.Parent.Parent
end
if plr:FindFirstChild("PLRcrushed") then
print("Player has been crushed already")
else
if plr.Humanoid.RigType == Enum.RigType.R6 then
MPART = "Torso"
elseif plr.Humanoid.RigType == Enum.RigType.R15 then
MPART = "LowerTorso"
end
(Keep in mind I know a lot of scopes aren't closed, that's because it isn't the full script, i sent the part that errors)

2 comments
"ERROR!" is not a valid member of Model, Maybe i should have been more specific, but hit is the target of the mouse, And i need to know why doesn't MY script work, the variable plr refers to the character, which works perfectly, but when trying to look for the RigType in humanoid it just skips it, why?
I'm so confused, I really don't understand, the script works now but all I did was change "Enum.RigType" to "Enum.HumanoidRigType", I can't believe that was the problem, I appreciate your help tho!