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

The Parent property of "Block" is locked?

Asked by
RjsMc 48
7 years ago

This script has been working for so long now, now its saying an error:

The Parent property of RjsMcCar is locked, current parent: NULL, new parent Workspace <

local c1cost = 10000
local reb = 2
local player = game.Players.LocalPlayer
local leaderboard = player:WaitForChild("Values")
print(workspace:FindFirstChild(player.Name.."Car"))
script.Parent.Text = "Crest - "..c1cost.." | Rebirth 2"



local c1 = game.ReplicatedStorage.Cars["Crest"]:Clone() --Car





script.Parent.MouseButton1Click:connect(function()
    local search = workspace:FindFirstChild(player.Name.."Car")
    if (leaderboard.Coins.Value >= c1cost and leaderboard.Rebirth.Value >= 2) then
        if search == nil then
            script.Parent.Text = "Spawning Car..."
            wait(1)
            script.Parent.Text = "Crest - "..c1cost.." | Rebirth "..reb
            script.Parent.Parent.Parent.Parent:TweenPosition(UDim2.new(0.02, 0,1.004, 0), "Out", "Quad", 1, false, nil)
        c1.Name = player.Name.."Car"
        c1:MakeJoints()
        c1.Parent = game.Workspace --I think the error is here | The Parent property of RjsMcCar is locked, current parent: NULL, new parent Workspace


        c1:MoveTo(player.Character.Torso.Position + Vector3.new(10, 0, 0))
        else





            search:Destroy()
            script.Parent.Text = "Previous Car Removed... Spawning Car"
            wait(1)
            script.Parent.Text = "Crest - "..c1cost.." | Rebirth "..reb
            script.Parent.Parent.Parent.Parent:TweenPosition(UDim2.new(0.02, 0,1.004, 0), "Out", "Quad", 1, false, nil)
        c1.Name = player.Name.."Car"
        c1.Parent = game.Workspace
        c1:MakeJoints()
        c1:MoveTo(player.Character.Torso.Position + Vector3.new(10, 0, 0))
        end




    else
        if leaderboard.Rebirth.Value >= 2 then
            script.Parent.Text = "Need $"..c1cost - leaderboard.Coins.Value
            wait(1)
            script.Parent.Text = "Crest - "..c1cost.." | Rebirth "..reb
        else
            script.Parent.Text = "Need Rebirth "..reb
            wait(1)
            script.Parent.Text = "Crest - "..c1cost.." | Rebirth "..reb
        end
    end
end)



0
That error often happens if you try to set the parent of something to two different things at the same time. mattscy 3725 — 7y

Answer this question