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
 

Re: Im so excited lmfao i made my first script :D

Previous Thread :: Next Thread 
seacat26 is online. seacat26
Joined: 19 Aug 2011
Total Posts: 6265
13 Jan 2016 06:24 PM
while true do
game.Workspace.Grass.Transparency = 0.5
wait()
game.Workspace.Grass.Transparency = 0.5
wait()
game.Workspace.Grass.Transparency = 0.5
wait()
game.Workspace.Grass.Transparency = 1
wait()
game.Workspace.Grass.Transparency = 1
wait()
game.Workspace.Grass.Transparency = 1
end


The grass just flashes and its the best thing that ever happened in my scripting carrer (which is very bad)



ᔕᙓᗩᙅᗩ☂26
Report Abuse
super10099 is not online. super10099
Joined: 30 Jan 2010
Total Posts: 1102
13 Jan 2016 06:26 PM
lies.. your first script was

print 'Hello world!'
Report Abuse
seacat26 is online. seacat26
Joined: 19 Aug 2011
Total Posts: 6265
13 Jan 2016 06:27 PM
True wow i got exposed



ᔕᙓᗩᙅᗩ☂26
Report Abuse
litalela is not online. litalela
Joined: 30 Mar 2010
Total Posts: 6267
13 Jan 2016 06:29 PM
while true do
game.Workspace.Grass.Transparency = 0.5
wait(1/10)
game.Workspace.Grass.Transparency = 1
wait(1/10)
end

➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ
Report Abuse
seacat26 is online. seacat26
Joined: 19 Aug 2011
Total Posts: 6265
13 Jan 2016 06:33 PM
Im new so idk how to do shortcuts lmfao



ᔕᙓᗩᙅᗩ☂26
Report Abuse
litalela is not online. litalela
Joined: 30 Mar 2010
Total Posts: 6267
13 Jan 2016 06:44 PM
pm me if you need tips or help, im glad to help

➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
13 Jan 2016 07:20 PM
while wait(0.1) do
workspace.Grass.Transparency = workspace.Grass.Transparency == 0.5 and 1 or 0.5
end
Report Abuse
litalela is not online. litalela
Joined: 30 Mar 2010
Total Posts: 6267
13 Jan 2016 07:39 PM
forever are you okay?

➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
13 Jan 2016 07:40 PM
hm
Report Abuse
litalela is not online. litalela
Joined: 30 Mar 2010
Total Posts: 6267
13 Jan 2016 07:42 PM
how in the world does that code work

wow roblox lua has some spooky features


➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
13 Jan 2016 07:44 PM
thats just a lua feature, not roblox lua

and https://en.wikipedia.org/wiki/Ternary_operation
Report Abuse
litalela is not online. litalela
Joined: 30 Mar 2010
Total Posts: 6267
13 Jan 2016 07:46 PM
lmao

the more you know

probs cause i never had to do something of the sort

➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Jan 2016 07:46 PM
"x.Transparency = x.Transparency == 0.5 and 1 or 0.5"
You have to realize the right side is evaluated first, everything after the equal sign.

"x.Transparency == 0.5" that's a conditional operation, if it is 0.5 then "true" is returned, otherwise "false" is returned.
x AND y will return y if x is truthy, else return x
x OR y will return x if x is truthy, else return y

The above can be grouped to make it more clear:
(x.Transparency == 0.5 and 1) or 0.5

If x.Transparency == 0.5 then "1" is returned.
If it's not == 0.5 then it'll be false, and false OR 0.5 is 0.5.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Jan 2016 07:47 PM
It's not a ternary operator.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
13 Jan 2016 07:49 PM
it can be used in the exact same fashion tho
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Jan 2016 07:51 PM
No, thinking that will cause you trouble later.

"x and y or z" is different from "x ? y : z" even though MOST of the time it'll give you the same results.

Suppose y is false, you wanted to return false if something happened. In the latter (the actual ternary operator) you would get what you expected: false. In the former, z will be returned.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
13 Jan 2016 07:52 PM
the more you know
Report Abuse
SwagCuzYolo is not online. SwagCuzYolo
Joined: 31 Oct 2013
Total Posts: 1224
13 Jan 2016 07:57 PM
How do you make something so simple so hard mg
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Jan 2016 07:58 PM
Because it's not simple in the first place unless you know what's going on. If it seems hard then you never understood it.
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
13 Jan 2016 08:03 PM
the ternary operator is very handy
Report Abuse
BasicBrandon is not online. BasicBrandon
Joined: 20 Jun 2011
Total Posts: 1833
13 Jan 2016 08:12 PM
Foreverdev you need to make more scripting tutorials
Report Abuse
kindcdog09 is not online. kindcdog09
Joined: 18 Nov 2010
Total Posts: 2421
13 Jan 2016 08:12 PM
I've just started scripting a couple weeks ago, but I'm kinda slow.

It get's real fun once you can make Lava bricks of your own! Like this one I've recently made:

local function onTouched(part)
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil then
h.Health = 0
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
13 Jan 2016 08:17 PM
script.Parent.Touched:connect(function(p)pcall(function()p.Parent.Humanoid.Health=0;end) end)
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