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 » Scripting Helpers
Home Search
 

Re: A little problem

Previous Thread :: Next Thread 
looloopaa is not online. looloopaa
Joined: 31 May 2008
Total Posts: 8
11 Dec 2011 08:46 PM
Hi. I'm what you might call a Frankenstein scripter, meaning I take bits from one script and mash it with others; as long as I know what I'm doing that is. Here's my problem: A script that I've edited only works in solo mode. It's a script for a conveyor belt that can turn on and off.

---------
local isOn = true

function on()
isOn = true
script.Parent.BrickColor = BrickColor.new(1)
script.Parent.Velocity = Vector3.new(0, 0, 0)
end

function off()
isOn = false
script.Parent.BrickColor = BrickColor.new(21)
script.Parent.Velocity = Vector3.new(20, 0, 0)
end

function onClicked()

if isOn == true then off() else on() end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

on()
---------

So what it should do is, when off it turns red and makes the velocity 20. When it's on, it's white and it makes it not be on. Yes I know, I did it backwards. Due to my lack of scripting knowledge, I'm not sure what is wrong, but I do know that SOMETHING is screwy either with roblox or my script. Here is the original script. It was from a thruster that turned on and off.

---------
local isOn = true

function on()
isOn = true
script.Parent.Reflectance = 0
script.Parent.BodyThrust.force = Vector3.new(0, 0, 0)
end

function off()
isOn = false
script.Parent.Reflectance = .3
script.Parent.BodyThrust.force = Vector3.new(1000, 0, 0)
end

function onClicked()

if isOn == true then off() else on() end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

on()
---------

So, yeah; please help?
Report Abuse
Ubernoob1234 is not online. Ubernoob1234
Joined: 27 Nov 2010
Total Posts: 8518
11 Dec 2011 09:01 PM
I'd have to think..
Report Abuse
looloopaa is not online. looloopaa
Joined: 31 May 2008
Total Posts: 8
11 Dec 2011 09:41 PM
If you aren't going to post something helpful, please don't post at all. While my place may not be popular, my friends and I play on it and we'd like to be able to use conveyor belts. If nobody knows how to fix this, fine. If you need to see the models the scripts are from, I'll publish them and post the links.
Report Abuse
mage11561 is not online. mage11561
Joined: 03 Sep 2008
Total Posts: 13217
11 Dec 2011 09:47 PM
calm down there.
i'd use a bool value for it..


belt = script.Parent
bool = script.Parent.BoolValue
function onClicked()
if bool.Value == false then
bool.Value = true
belt.BrickColor = BrickColor.new(21)
belt.Velocity = Vector3.new(20,0,0)
else if bool.Value == true then
bool.Value = false
belt.BrickColor = BrickColor.new(1)
belt.Velocity = Vector3.new(0,0,0)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)








Report Abuse
mage11561 is not online. mage11561
Joined: 03 Sep 2008
Total Posts: 13217
11 Dec 2011 09:49 PM
oopsy,
i think you'd have to make "else if" into "elseif"
idk if it makes a difference though.
and i think i forgot an end after the "if bool.Value == false then"
maybe not.
happy scripting, i hope this works.
Report Abuse
soccaboy17 is not online. soccaboy17
Joined: 22 Sep 2009
Total Posts: 3161
11 Dec 2011 09:59 PM

function on()
isOn = true
script.Parent.Reflectance = 0
script.Parent.BodyThrust.force = Vector3.new(0, 0, 0)
end

function off()
isOn = false
script.Parent.Reflectance = .3
script.Parent.BodyThrust.force = Vector3.new(1000, 0, 0)
end

on()
function onClicked()

if isOn == true then off() else on() end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Report Abuse
mage11561 is not online. mage11561
Joined: 03 Sep 2008
Total Posts: 13217
11 Dec 2011 09:59 PM
@socca,
he wanted a conveyor belt,
which can be easily done with Velocity, no need for a BodyThrust :P
Report Abuse
looloopaa is not online. looloopaa
Joined: 31 May 2008
Total Posts: 8
12 Dec 2011 10:34 AM
@ mage11561

Thanks for your help. Unfortunately, it didn't seem to work. I tried messing with it, too, after the first try, but as I probably have said, I'm not the best scripter by a long shot. Also a confirmation on the oddness of this, it works fine in build mode too. It seems that the problem is only in a server. I just tested this by starting a server and a player in roblox studio. I also forgot to mention, the ORIGINAL conveyor belt works, but when you try to copy it, it stays the same color as the conveyor belt and doesn't change when you click on it. All of the things are still in the copied brick too.

Any more suggestions? This has me absolutely befuddled. The oddest part is that I have practically the same script in several other things and they all work fine.
Report Abuse
looloopaa is not online. looloopaa
Joined: 31 May 2008
Total Posts: 8
12 Dec 2011 07:55 PM
Well, I've gone ahead and found a different script. Thanks to the few good people who tried to help.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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