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

Why doesnt this Server Script work in tool with variable?

Asked by
proo34 41
4 years ago
--Decides how brick will look
script.Parent:WaitForChild("Handle")
script.Parent:WaitForChild("DecisionVariables")

--Variables
local B = script.Parent.Handle
local DeVb = script.Parent.DecisionVariables

--Block Property Variables
local getperbrick = DeVb.getperbrick --How much brick you get per brick you eat
local timeperbrick = DeVb.timeperbrick --How long it takes o eat a brick
local brickMultip = DeVb.brickMultip --Multiply the amount when eaten
local moneyperate = DeVb.moneyperate --How much money you get per every amount eaten
local moneymultip = DeVb.moneymultip --Multiply the money gotten
local atetilmoney = DeVb.atetilmoney --How many bricks to eat before rewarded money
local BrickName = DeVb.BrickName --Name of brick

while true do
wait()
--Updates to make sure player has the correct brick they want. There are 
--about 50 bricks avalible for the player to choose from.
--local Cr = script.Parent.Main.BrickDecision.Current.Value

    if script.Parent.Main.BrickDecision.Current.Value == 1 then
    --Normal Brick
    B.BrickColor = BrickColor.Red()
    B.Material = Enum.Material.Concrete
        --Brick Values
        getperbrick.Value = 1
        timeperbrick.Value = 2
        brickMultip.Value = 1
        moneyperate.Value = 20
        moneymultip.Value = 1
        atetilmoney.Value = 10
        BrickName.Value = "Normal Brick"

    end

    if script.Parent.Main.BrickDecision.Current.Value == 2 then
    --Marble Brick
    B.BrickColor = BrickColor.White()
    B.Material = Enum.Material.Marble
        --Brick Values
        getperbrick.Value = 1.2
        timeperbrick.Value = 2.5
        brickMultip.Value = 1.2
        moneyperate.Value = 18
        moneymultip.Value = 1
        atetilmoney.Value = 10
        BrickName.Value = "Marble Brick"

    end

    if script.Parent.Main.BrickDecision.Current.Value == 3 then
    --Brock
    B.BrickColor = BrickColor.DarkGray()
    B.Material = Enum.Material.Granite
        --Brick Values
        getperbrick.Value = 15
        timeperbrick.Value = 5
        brickMultip.Value = 1.7
        moneyperate.Value = 50
        moneymultip.Value = 1.3
        atetilmoney.Value = 8
        BrickName.Value = "The Brock"       
    end

end

the script needs to change the handles properties to make it look different. It uses the value called current to know which one to use. This will not work, any ideas on how to fix this?

Thanks!

Answer this question