In functions, how do I replace a properties with a Parameter/Argument

function IsLoading(Room, RoomSpec)
	local Spec = Room.RoomSpec
end

I want to replace the property with the Parameter, but every single time it keeps giving me an error “RoomSpec is not in game.Workspace.Room”

How do I replace the property with a parameter without getting an error?

Edit: The problem is sloved, I ended up using a different method instead of this one

I don’t even understand what are you trying to do by this piece of code you’ve provided.
Give us more information… We don’t know what value is Room and RoomSpec

You’re directly indexing, which makes the VM try to search through the object’s properties and children for something named RoomSpec. You have to use brackets:

function IsLoading(Room, RoomSpec)
	local Spec = Room[RoomSpec]
end
1 Like