Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Having troubles with routing inside a model? *Not answered yet*

First, let me show you a picture of how it's set up.. http://gyazo.com/b21445273df500eff12ea3a52e46eb19 I don't know if i'm allowed to post links, I didn't see anything within the guidelines. But there it is. It's nothing bad, just a picture of the explorer.

What I'm trying to do is route from 'Part' that's within the first model 'Name' to the model 'Generator'..

rate = script.Parent.Parent.Generator.Drop.rate

What it says is "Generator is not a valid member of Model"

If you want to see the entire script, let me know, I will edit this and post it below.

Due to a request, here is the full script so far... Please keep in mind, I haven't been able to test everything in the script currently, Because it only stops at line 2.

debounce = true
rate = script.Parent.Parent.Generator.Drop.rate
brick = script.Parent
choice = script.Parent.Parent.Generator.Drop.chance
auto = script.Parent.Parent.Generator.Drop.Auto
chance = game.Lighting:FindFirstChild("Win"):GetChildren()
Chance = game.Lighting:FindFirstChild("Bricks"):GetChildren()

script.Parent.Click.MouseClick:connect(function ()
	if debounce == true and auto.Value == 0 then
		debounce = false
		brick.BrickColor = BrickColor.new("Red")
		wait(rate.Value)
		choice.Value = math.random(1,100)
		if choice.Value < 55 then
			local it = Chance[math.random(1,#Chance)]:Clone()
			it.Position = script.Parent.Position
			it.Parent = game.Workspace
		else 
			local it = chance[math.random(1,#chance)]:Clone()
			it.Position = script.Parent.Position
			it.Parent = game.Workspace
		end
		brick.BrickColor = BrickColor.new("Green")
	end
end)

1 comment

0

Entire script please, I can't help you much with just that.

1 answer

script.Parent is the brick named Drop, script.Parent.Parent is the generator model, therefore searching for something named 'Generator' inside the generator model will result in an error.

Do script.Parent.Parent.Parent instead.

1 comment

0

No, i'm going from the Part located within 'Name'. The script isn't located within Generator.

This discussion is preserved as it was. New answers, comments, and votes are closed.