|
| 28 Jul 2011 09:35 AM |
Here is the script. I will only post the error.
function onTouch() if game.Workspace.Frame.Transparency = 1 then --Stuff goes here. else if game.Workspace.Frame.Transparency = 0 then --Other stuff goes here. end end end
script.Parent.Touched:connect(onTouch)
Here is the output: Workspace.Part,Script:2: 'then expected near '='
This happens everytime I use an if statement. I don't understand what the output is telling me since I already have then on the script. Can anyone help me? |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2011 09:38 AM |
if game.Workspace.Frame.Transparency = 1 then
when checking a value user double ='s
if game.Workspace.Frame.Transparency == 1 then
‹•º`¨´º•¸ ~ Mitch ~ ¸•º`¨´º•› |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2011 09:40 AM |
When making a statement, You want to check if something is equal to, Not equals __. Also you can use "elseif" insead of "else if", using mine you need no extra end. And I added a debounce.
enabled = true function onTouch() if not enabled then return end enabled = false if game.Workspace.Frame.Transparency == 1 then --Stuff goes here. elseif game.Workspace.Frame.Transparency == 0 then --Other stuff goes here. end enabled = true end script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jul 2011 09:41 AM |
Of course I beat you, you typed like 2 paragraphs
‹•º`¨´º•¸ ~ Mitch ~ ¸•º`¨´º•› |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2011 09:42 AM |
| Thanks. I don't need a debounce, but thanks for telling me the elseif and == thing. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2011 09:48 AM |
| Actually, you will find when using touch events you need debounces a lot of the time. I personally do enabled, not debounce, but they do the same thing. If you have print()'s in your script, they will print multiple times if you dont have a debounce. |
|
|
| Report Abuse |
|
|