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

Can someone help edit this script? (re asked due to irrelevancy)

Asked by 8 years ago
local brick = workspace.brick

function loopityLoop()
    while brick.BrickColor = BrickColor.Red() do -- The loop that will run until "brick.BrickColor" isn't red anymore! (Also "BrickColor.Red()" is the bright red color!)

game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
    if string.lower(key) ==  "q" then


local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" 

local animTrack = Humanoid:LoadAnimation(animation)  
animTrack:Play()


    end
end)


    wait() -- Used so studio nor Roblox will crash!
    end
end

brick.Changed:connect(loopityLoop)

game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
    if string.lower(key) ==  "q" then
brick.BrickColor = BrickColor.Red()
local b2 = workspace.b2
  b2 BrickColor = BrickColor.White()

Please help edit

0
Your problem is line 4; You can't use a single '=' when comparing a Condition to an Argument, it requires the '==' (= means to set the Variable, == means to compare a Value to another). TheeDeathCaster 2368 — 8y
0
Also, that script's off the Roblox Wiki, should be fixed if it's incorrect. Laserpenguin12 85 — 8y

1 answer

Log in to vote
0
Answered by
davness 376 Moderation Voter
8 years ago

I detected two errors on your script.

1. Compare or assigning?

You are doing an error on the line 4:

Example:

while money = 5 do

You are assigning a value. As TheAlphaStigma said, = writes a variable, == compares it with another value

2. Badly idented script = confusing = less attractive to help

If your script isn't idented correctly, it will be harder for we to answer your question.

So, the full script:

local brick = workspace.brick

function loopityLoop()
    while brick.BrickColor == BrickColor.Red() do -- The loop that will run until "brick.BrickColor" isn't red anymore! (Also "BrickColor.Red()" is the bright red color!)
        game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
            if string.lower(key) ==  "q" then
                local animation = Instance.new("Animation")
                animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" 
                local animTrack = Humanoid:LoadAnimation(animation)  
                animTrack:Play()
            end
        end)
        wait() -- Used so studio nor Roblox will crash!
    end
end

brick.Changed:connect(loopityLoop)

game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
    if string.lower(key) ==  "q" then
        brick.BrickColor = BrickColor.Red()
        local b2 = workspace.b2
        b2 BrickColor = BrickColor.White()
    end
end)
Ad

Answer this question