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

What is wrong in this script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
01model = script.Parent.Parent.Parent.CarSeat.Value.Parent.Parent
02 
03function onclick ()
04    sell = script.Parent.Parent.Parent.sell.Value
05    local stats = game.Players.LocalPlayer:FindFirstChild("leaderstats")
06    if stats ~= nil then
07        local cash = stats:FindFirstChild("Money")
08        cash.Value = cash.Value + sell
09        script.Parent.Parent.Parent:Destroy()
10        script.Parent.Parent.Parent.Parent.Parent.Parent:remove()
11    end
12 
13end
14 
15script.Parent.MouseButton1Click:connect(onclick)

it says: 00:01:16.443 - Players.Player.PlayerGui.Screen.Frame.TextButton.Script:10: attempt to index field 'Parent' (a nil value) 00:01:16.444 - Script 'Players.Player.PlayerGui.Screen.Frame.TextButton.Script', Line 10

0
What are you trying to do with this? Im_Kritz 334 — 9y
0
it is a script for selling stuff thegamingpro566 0 — 9y
0
its ok guys i figured the problem my self i fixed the problem the script works fine now thegamingpro566 0 — 9y

1 answer

Log in to vote
2
Answered by
Chronomad 180
9 years ago

Well, it looks like you already removed the script on line 9

1script.Parent.Parent.Parent:Destroy()

So instead, I'd remove line 9 entirely, and change line 10 to say,

1script.Parent.Parent.Parent.Parent.Parent.Parent:Destroy() -- remove is old school

Hope this helps! Let me know if it did.

0
i figured it out but i changed some other stuff on the script aswell as that there was something wrong with some things at the top i had to add some stuff to it thegamingpro566 0 — 9y
Ad

Answer this question