generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Errors in my script, help!

Previous Thread :: Next Thread 
doat is not online. doat
Joined: 28 Aug 2009
Total Posts: 65
26 Jan 2016 09:25 PM
Hello,
I'm writing a script, but whenever I try to test it in game, 2 errors pop up:
1) new is not a valid member
2)Brickcolor is not a valid member of Part




Here's what the script looks like



Box = script.Parent.ShopFrame
Button1 = script.Parent.ShopFrame.Accept
Button2 = script.Parent.ShopFrame.Deny
Open = true
local debounce = false
wait(1)
Money = game.Players.LocalPlayer.leaderstats.SkateBux
Part1 = game.Workspace.HalfpipeCount.Part1
Part2 = game.Workspace.HalfpipeCount.Part2

Button1.MouseButton1Down:connect(function(CloseAndStart)
if Open ==true then
Box.Visible = false
Open = false
print "Go"
end
end)

function onTouched(hit)
Part1.Brickcolor = Part1.Brickcolor.new("Lime green")
wait(2)
Part1.BrickColor = Part1.Brickcolor.new("Cashmere")
end

function Part2onTouched(hit)
Part2.Brickcolor = Part2.Brickcolor.new("Lime green")
wait(60)
Part2.BrickColor = Part2.Brickcolor.new("Cashmere")
end

function onTouched(hit)
if not debounce then
debounce = true
Part1.BrickColor = Part1.BrickColor.new("Lime green")
if Part2.BrickColor == ("Lime green") then
Money.Value = (Money.Value + 300)
print "Awarded 300 SkateBux"
wait(2)
Part1.BrickColor = Part1.BrickColor.new("Cashmere")
debounce = false

end
end
end

game.Workspace.HalfpipeCount.Part1.Touched:connect(onTouched)
game.Workspace.HalfpipeCount.Part2.Touched:connect(Part2onTouched)

Button2.MouseButton1Down:connect(function(Close)
wait(1)
if Open ==true then
Box.Visible = false
Open = false
end
end
Report Abuse
iPenguinSuperTime is not online. iPenguinSuperTime
Joined: 25 Apr 2012
Total Posts: 3757
26 Jan 2016 09:35 PM


function onTouched(hit)
Part1.Brickcolor = Brickcolor.new("Lime green")
wait(2)
Part1.BrickColor = Brickcolor.new("Cashmere")
end

function Part2onTouched(hit)
Part2.Brickcolor = Brickcolor.new("Lime green")
wait(60)
Part2.BrickColor = Brickcolor.new("Cashmere")
end

function onTouched(hit)
if not debounce then
debounce = true
Part1.BrickColor = BrickColor.new("Lime green")
if Part2.BrickColor == ("Lime green") then
Money.Value = (Money.Value + 300)
print "Awarded 300 SkateBux"
wait(2)
Part1.BrickColor = BrickColor.new("Cashmere")
---------------------------------------------------
Simple error, instead of;

"Part1.BrickColor = Part1.BrickColor.new("color")"

you just needed

Part1.BrickColor = BrickColor.new("color")
Report Abuse
doat is not online. doat
Joined: 28 Aug 2009
Total Posts: 65
26 Jan 2016 09:37 PM
Thank you!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image