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 |
|
|
|
| 13 Jan 2016 06:26 PM |
lies.. your first script was
print 'Hello world!' |
|
|
| Report Abuse |
|
|
seacat26
|
  |
| Joined: 19 Aug 2011 |
| Total Posts: 6265 |
|
|
| 13 Jan 2016 06:27 PM |
True wow i got exposed
ᔕᙓᗩᙅᗩ☂26 |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 13 Jan 2016 07:39 PM |
forever are you okay?
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 Jan 2016 07:47 PM |
| It's not a ternary operator. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2016 07:49 PM |
| it can be used in the exact same fashion tho |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
|
| 13 Jan 2016 07:57 PM |
| How do you make something so simple so hard mg |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 13 Jan 2016 08:03 PM |
| the ternary operator is very handy |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2016 08:12 PM |
| Foreverdev you need to make more scripting tutorials |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 13 Jan 2016 08:17 PM |
| script.Parent.Touched:connect(function(p)pcall(function()p.Parent.Humanoid.Health=0;end) end) |
|
|
| Report Abuse |
|
|