I'm having this error -- > Workspace.Mdoor.Union.Script:26: bad argument #2 to '?' (Vector3 expected, got Object)
Script was working fine but I had to revert versions because I accidentally lost the script and I can't remember how I fixed this error. Can anyone help?
local rs = game:GetService("ReplicatedStorage")
local r = rs.Remotes:WaitForChild("DoorOpen1")
r.OnServerEvent:connect(function(HRP)
if (script.Parent.Position - HRP).magnitude <= 3 then --Error Happens Here!
print(r.Name.. " was fired!")
local door = game.Workspace.Mdoor:WaitForChild("Union")
local hinge = game.Workspace.Mdoor:WaitForChild("Hinge")
local hingep = hinge.Position
for i = 1, 120 do
door.CFrame = CFrame.new(hingep)* CFrame.Angles(0,math.rad(i),0) * CFrame.new(0.294,0,2.89500)
wait()
end
end
end)
Also I should note HRP is defined as LocalPlayer.Character:WaitForChild("HumanoidRootPart").Position

1 comment
but as a pretty decent scripter i dont find these things hard