I learned how to do speed boosts from a video about a month or two ago. Although, I want to script a block that changes colors when you step on a pad. I have an error saying that "the passed value is not a function". Here is what I have:
local Pad = script.Parent local Blob = script.Parent.Parent local function onTouch(Player) Blob.BrickColor = Red wait(0.5) Blob.BrickColor = Orange wait(0.5) Blob.BrickColor = Yellow wait(0.5) Blob.BrickColor = Green wait(0.5) Blob.BrickColor = Toothpaste wait(0.5) Blob.BrickColor = Magnenta wait(0.5) end Blob.Touched:connect(steppedOn)
On line 18, you're calling a function that doesn't exist
On line 4, you make a function named "onTouch". On line 18 however, you try to call a function by the name of "steppedOn", which doesn't exist.
To fix this, just rename the function or you're call. Below are the two possible fixes,
local Pad = script.Parent local Blob = script.Parent.Parent local function onTouch(Player) Blob.BrickColor = Red wait(0.5) Blob.BrickColor = Orange wait(0.5) Blob.BrickColor = Yellow wait(0.5) Blob.BrickColor = Green wait(0.5) Blob.BrickColor = Toothpaste wait(0.5) Blob.BrickColor = Magnenta wait(0.5) end Blob.Touched:connect(OnTouch)--Renamed
Or
local Pad = script.Parent local Blob = script.Parent.Parent local function steppedOn(Player)--Renamed Blob.BrickColor = Red wait(0.5) Blob.BrickColor = Orange wait(0.5) Blob.BrickColor = Yellow wait(0.5) Blob.BrickColor = Green wait(0.5) Blob.BrickColor = Toothpaste wait(0.5) Blob.BrickColor = Magnenta wait(0.5) end Blob.Touched:connect(steppedOn)
EDIT,
You're not changing the color right.
When changing the color of a brick, you need to use BrickColor.new()
Here's your final fixed script,
local Pad = script.Parent local Blob = script.Parent.Parent local function steppedOn(Player)--Renamed Blob.BrickColor = BrickColor.new("Really red")--make sure the names of the colors are right wait(0.5) Blob.BrickColor = BrickColor.new("Orange")--Not Sure what the right name is wait(0.5) Blob.BrickColor = BrickColor.new("New yeller") wait(0.5) Blob.BrickColor = BrickColor.new("Camo") wait(0.5) Blob.BrickColor = BrickColor.new("Toothpaste") wait(0.5) Blob.BrickColor = BrickColor.new("Magnenta")--Not sure the right color wait(0.5) end Blob.Touched:connect(steppedOn)
You may need to change the names of the colors to the weird names Roblox has given them.
That should fix the errors and make the brick change colors.
Good Luck!