Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

parent is not a valid member of Model? plzz help

Asked by 7 years ago

It says "parent is not a valid member of Model"

    for _, object in pairs(game.ServerStorage:GetChildren()) do
        local CarCopy = object:clone()
        CarCopy.parent = game.Workspace
        CarCopy:MakeJoints()
    end

I want to make the CarCopy to go in to the Workspace from my ServerStorage but it is not doing it here is all the scripts in that one script

local RespawnCarsBlock = game.Workspace.RestartCars


function RespawnCars()
    print("Cars is respawning!")

    for _, object in pairs(game.Workspace:GetChildren()) do
        print(object.name)
        if object.name == "Motorcycle" then
            print("this is a Motorcycle we need to destroy it!")
            object:destroy()
        end
    end

    for _, object in pairs(game.ServerStorage:GetChildren()) do
        local CarCopy = object:clone()
        CarCopy.parent = game.Workspace
        CarCopy:MakeJoints()
    end




end


RespawnCarsBlock.Touched:connect(RespawnCars())

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

It's Parent not parent. Lua is Case Sensitive.

Also, your :Connect line on the button calls the function instead of binding it. (That'll error.) Remove the extra () inside of the :Connect(FunctionName())

0
Thank you very much it worked Thank you RubenKan how can i +rep you criller7070 6 — 7y
0
You could click the Accept Answer button on the bottom. V RubenKan 3615 — 7y
0
i dont see it criller7070 6 — 7y
0
it came up right after i rote "i dont see it" criller7070 6 — 7y
Ad

Answer this question