Hello, I'm trying to make a script that when you hit a part named "Vetro" the part destroys. I'm doing it serverside.
I get the error "Attempt to index nil with "IsA"?" and I don't understand why I can't fix it.
Take note that that's a RemoteEvent, that's why I've put the if statement.
ServerSide script:
if t == "w" then
local function vetro(hitted)
if hitted:IsA("BasePart") and hitted.Name == "Vetro" and hitted.Transparency > 0 then
hitted:Destroy()
end
end
vetro()
end
ClientSide script part:
function vetro()
script.Parent.Event:FireServer("w")
end
I've also tried changing "IsA" with ClassName but still getting an error. Can someone help me please?

6 comments
You need to pass something to the function
what do you mean?
On line 7, you need to pass something to the function. The object that hitted.
I've tried putting hitted but always the same.
im not sure if its supposed to be this exactly but i thought IsA is supposed to go with in pairs loop
It does not. The error also means that "Hitted" doesn't exist, you never passed any BasePart into "vetro".