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

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

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

2 comments

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).

0

Also, that script's off the Roblox Wiki, should be fixed if it's incorrect.

1 answer

✓ Accepted answer

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)

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