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
 

Why doesn't thing work? (short)

Previous Thread :: Next Thread 
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 04:41 PM
sp = script.Parent
q = "p = "
p = "q"

while true do

debounce = true

function onTouched()
debounce = false
m = Instance.new("Message", workspace)
m.Text = q .. p
debounce = true
wait(5)
m:Remove()
end
wait()
end

sp.Touched:connect(onTouched)

Whenever I put the function call into the while loop it works, but if I take it out it doesn't. :P
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
08 Oct 2014 04:44 PM
What is the while loop even there for...
Report Abuse
Dralian is not online. Dralian
Joined: 21 Mar 2013
Total Posts: 7624
08 Oct 2014 04:54 PM
I think he wants it to repeat it.

but personally, if you want to do it when a player is added use playeradded.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
08 Oct 2014 04:56 PM
A touched event already repeats every time its touched
Report Abuse
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 05:04 PM
debounce says otherwise
Report Abuse
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 05:07 PM
Fixed it. I placed the wait() wrong.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
08 Oct 2014 05:08 PM
local sp, q, p, bounce = script.Parent, "p = ", "q", true

script.Parent.Touched:connect(function(part)
if bounce then
bounce = false
local message = Instance.new("Message", workspace)
message.Text = q .. p
wait(5)
message:Destroy()
bounce = true
end
end)
Report Abuse
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 05:08 PM
and i forgot the if-then return end for debounce, silly me.
Report Abuse
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 05:09 PM
@128 as usual i like yours better.
Report Abuse
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 05:12 PM
"local sp, q, p, bounce = script.Parent, "p = ", "q", true"

What does this mean?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
08 Oct 2014 05:15 PM
local a = 1
local b = 2
print(a) -->1
print(b) -->2



local a, b = 1, 2
print(a) -->1
print(b) -->2


Just defining variables at the same time to save space
It can be useful for more than just saving space though, for swapping values for example

local a, b = 1, 2
print(a) -->1
print(b) -->2


a, b = b, a
print(a) -->2
print(b) -->1
Report Abuse
CategoricalSyllogism is not online. CategoricalSyllogism
Joined: 30 Aug 2013
Total Posts: 7680
08 Oct 2014 05:18 PM
Thanks
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