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: How would I do this?

Previous Thread :: Next Thread 
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:03 AM
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
print("broken!")
wait(6)
end)
wait(6)
sp.cureWait .Value = sp.cureWait.Value - 2
b:remove()

How would I make this script do this:

If it is collected in under six seconds then remove it. But if it isn't collected in under six seconds then remove two from cureWait.

Thank you
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:07 AM
bump
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:12 AM
bumpy
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:15 AM
pmub
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:21 AM
Maybe something like this?:
while true do
wait(.1)
waittime = 0
collected = false
function time()
while wait(6) do
waittime + 1
end
end
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
collected = true
print("broken!")
end)
if waittime = 6 then
sp.dna.Value = sp.dna.Value + 3
b:remove()
elseif collected then
waittime = 0
end
end
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:23 AM
Corrections:
while true do
wait(.1)
waittime = 0
collected = false
function time()
while wait(1) do
waittime + 1
end
end
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
collected = true
print("broken!")
end)
if waittime >= 6 then
sp.dna.Value = sp.dna.Value + 3
b:remove()
elseif collected then
waittime = 0
end
end
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:24 AM
More corrections:

while true do
wait(.1)
waittime = 0
collected = false
function time()
while wait(1) do
waittime + 1
end
end
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
collected = true
print("broken!")
end)
if waittime >= 6 and collected = false then
sp.dna.Value = sp.dna.Value + 3
b:remove()
elseif collected then
waittime = 0
collected = false
end
end
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:29 AM
bumpss
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
19 Aug 2013 10:30 AM
Dude, If you bumped this many times, there probably not gonna help. Besides. All you gave us was 30 lines of code and said how do I do this?
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:31 AM
Full script:

function clone()
while true do
wait(15)
local m = math.random(1,5)
local a = math.random(50,65) * 10
local b = math.random(20,35) * 10
local model = script:findFirstChild("cb"..m)
local player = script.Parent.Parent.GameFrame.places
wait()
model:clone().Parent = player
model.Position = UDim2.new(0, a, 0, b)
if m == 1 then
cure1()
end
if m == 2 then
cure2()
end
if m == 3 then
cure3()
end
end
end
function cure1()
repeat
wait(.1)
waittime = 0
collected = false
function time()
while wait(1) do
waittime = waittime + 1
end
end
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
collected = true
print("broken!")
end)
if waittime >= 6 then
sp.dna.Value = sp.dna.Value - 3
b:remove()
elseif collected then
waittime = 0
end
until collected
end

function cure2()
repeat
wait(.1)
waittime = 0
collected = false
function time()
while wait(1) do
waittime = waittime + 1
end
end
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
collected = true
print("broken!")
end)
if waittime >= 6 then
sp.dna.Value = sp.dna.Value - 3
b:remove()
elseif collected then
waittime = 0
end
until collected
end

function cure3()
repeat
wait(.1)
waittime = 0
collected = false
function time()
while wait(1) do
waittime = waittime + 1
end
end
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1
local sound = sp.DnaClick
b.MouseButton1Click:connect(function()
b:remove()
sound:Play()
collected = true
print("broken!")
end)
if waittime >= 6 then
sp.dna.Value = sp.dna.Value - 3
b:remove()
elseif collected then
waittime = 0
end
until collected
end

clone()
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:32 AM
@madness
Is this possible though?
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
19 Aug 2013 10:32 AM
HE MENT!
Tell us what you think is the problem and the output!
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
19 Aug 2013 10:33 AM
local player = script.Parent.Parent.GameFrame.places
wait()
model:clone().Parent = player


I dont think the player is correctely definded.
Report Abuse
BruceAB12 is not online. BruceAB12
Joined: 19 Jan 2012
Total Posts: 3238
19 Aug 2013 10:34 AM
11:33:39.685 - cureBubbles is not a valid member of ScreenGui
11:33:39.686 - Script "Players.Player1.PlayerGui.Main.GameEngine", Line 154 - global start
11:33:39.686 - Script "Players.Player1.PlayerGui.Main.GameEngine", Line 128 - global load
11:33:39.686 - Script "Players.Player1.PlayerGui.Main.GameEngine", Line 82
11:33:39.687 - stack end
Collected!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
broken!
11:34:00.516 - cb1 is not a valid member of Frame
11:34:00.517 - Script "Players.Player1.PlayerGui.Main.GameEngine.cureBubbles", Line 36 - global cure1
11:34:00.517 - Script "Players.Player1.PlayerGui.Main.GameEngine.cureBubbles", Line 13 - global clone
11:34:00.517 - Script "Players.Player1.PlayerGui.Main.GameEngine.cureBubbles", Line 113
11:34:00.518 - stack end

lol output
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
19 Aug 2013 10:36 AM
local sp = script.Parent
local spp = sp.Parent
local a = spp.GameFrame.places
local b = a.cb1

Make sure there is a cb1 in places.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
19 Aug 2013 10:38 AM
IF you put the local cb1 = BLAH
if it is created by a scriht you have to wait until there is a cb1, WaitForChild("")

Try that.
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