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

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

Asked by
lomo0987 250 Moderation Voter
10 years ago

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)
0
Entire script please, I can't help you much with just that. SlickPwner 534 — 10y

1 answer

Log in to vote
-1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

0
No, i'm going from the Part located within 'Name'. The script isn't located within Generator. lomo0987 250 — 10y
Ad

Answer this question