MHXJoin Date: 2008-12-08 Post Count: 2049 |
Ive made this myself, and since Im not such a good scripter ... Its very easy. How to make this one easier? It laggs a lot when I use it.
If there's a way to make this easier, tell me HOW please. Not just "use tables"; I dont know how to use them and I failed at understanding the wiki.
print("JumperScript_Loaded")
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Parent.Torso.Velocity=Vector3.new(0,200,0)
local sec = script.Parent.Parent:findFirstChild("OneWayJumpSecurity")
sec.Transparency = 1
sec.CanCollide = false
F = Instance.new("Fire")
F.Parent = sec
F.Heat = 25
F.Size = 30
wait(1.5)
sec.Transparency = 0
sec.CanCollide = true
wait(8.5)
sec.Fire:Remove()
S = Instance.new("Smoke")
S.Parent = sec
S.Opacity = 1
S.RiseVelocity = 24
S.Size = 38
wait(1)
S.Size = 36
wait(1)
S.Size = 34
wait(1)
S.Size = 32
wait(1)
S.Size = 30
wait(1)
S.Size = 28
wait(1)
S.Size = 26
wait(1)
S.Size = 24
wait(1)
S.Size = 22
S.RiseVelocity = 22
wait(1)
S.Size = 20
S.RiseVelocity = 20
wait(1)
S.Size = 18
S.RiseVelocity = 18
wait(1)
S.Size = 16
S.RiseVelocity = 16
wait(1)
S.Size = 14
S.RiseVelocity = 14
wait(1)
S.Size = 12
S.RiseVelocity = 12
wait(1)
S.Size = 10
S.RiseVelocity = 10
wait(1)
S.Size = 8
S.RiseVelocity = 8
wait(1)
S.Size = 6
S.RiseVelocity = 6
wait(1)
S.Size = 4
S.RiseVelocity = 4
wait(1)
S.Size = 2
S.RiseVelocity = 2
wait(1)
S.Size = 1
S.RiseVelocity = 1
wait(1)
sec.Smoke:Remove()
end
end
end
script.Parent.Touched:connect(onTouched) |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
print("JumperScript_Loaded")
deb = false
function onTouched(part)
if part.Parent ~= nil and not deb then
deb = true
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Parent.Torso.Velocity=Vector3.new(0,200,0)
local sec = script.Parent.Parent:findFirstChild("OneWayJumpSecurity")
if not sec then deb = false return end
sec.Transparency = 1
sec.CanCollide = false
F = Instance.new("Fire")
F.Parent = sec
F.Heat = 25
F.Size = 30
wait(1.5)
sec.Transparency = 0
sec.CanCollide = true
wait(8.5)
sec.Fire:Remove()
S = Instance.new("Smoke", sec)
S.Opacity = 1
S.RiseVelocity = 24
for i = 38, 1, -1 do
S.Size = i
if i < 23 then
S.RiseVelocity = i
wait(1)
end
end
sec.Smoke:Remove()
end
end
deb = false
end
script.Parent.Touched:connect(onTouched) |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
Crap... The above script doesn't work as desired. Use this one:
print("JumperScript_Loaded")
deb = false
function onTouched(part)
if part.Parent ~= nil and not deb then
deb = true
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Parent.Torso.Velocity=Vector3.new(0,200,0)
local sec = script.Parent.Parent:findFirstChild("OneWayJumpSecurity")
if not sec then deb = false return end
sec.Transparency = 1
sec.CanCollide = false
F = Instance.new("Fire")
F.Parent = sec
F.Heat = 25
F.Size = 30
wait(1.5)
sec.Transparency = 0
sec.CanCollide = true
wait(8.5)
sec.Fire:Remove()
S = Instance.new("Smoke", sec)
S.Opacity = 1
S.RiseVelocity = 24
for i = 38, 1, -1 do
S.Size = i
if i < 23 then
S.RiseVelocity = i
end
wait(1)
end
sec.Smoke:Remove()
end
end
deb = false
end
script.Parent.Touched:connect(onTouched) |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
I'm trying to understand the script and the tables. Please answer y questions:
print("JumperScript_Loaded")
deb = false --Whats 'Deb', could you explain to me, please?
function onTouched(part)
if part.Parent ~= nil and not deb then
deb = true
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
h.Parent.Torso.Velocity=Vector3.new(0,200,0)
local sec = script.Parent.Parent:findFirstChild("OneWayJumpSecurity")
if not sec then deb = false return end
sec.Transparency = 1
sec.CanCollide = false
F = Instance.new("Fire")
F.Parent = sec
F.Heat = 25
F.Size = 30
wait(1.5)
sec.Transparency = 0
sec.CanCollide = true
wait(8.5)
sec.Fire:Remove()
S = Instance.new("Smoke", sec) --Whats 'sec' for at this part? Do you want to spawn 'sec', or what's that for?
S.Opacity = 1
S.RiseVelocity = 24
for i = 38, 1, -1 do -- 38 is Size, 1 is the time between the Sizes and -1 the number to subtract everytime, am I right? Is the order always Value, Time, Effect?
S.Size = i --Adds Size to the definition i, am I right?
if i < 23 then -- if Size is below 23 the same process happens to RiseVelocity, right? But what about i = 38, is the script ignoring this part because you defined RiseVelocity before?
S.RiseVelocity = i -- Does Size get disabled or does i work for Size and RiseVelocity now?
wait(1)
end
end
sec.Smoke:Remove()
end
end
deb = false
end
script.Parent.Touched:connect(onTouched) |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
I guess I didn't explain it, did I?
S = Instance.new("Smoke", sec)
--Whats 'sec' for at this part? Do you want to spawn 'sec', or what's that for?
--sec is your defined brick. In the Instance.new function, the first argument (a string) represents the className,
--and the second argument (a userdata) is the PARENT of the newly created object. The default value for the
--second argument is nil, unless stated otherwise.
for i = 38, 1, -1 do
-- 38 is Size, 1 is the time between the Sizes and -1 the number to subtract everytime, am I right? Is the
--order always Value, Time, Effect?
--This line just creates a countdown. It starts from 38 and counts to 1 by adding -1.
S.Size = i
--Adds Size to the definition i, am I right?
--No. Size is SET to the value of i. Since we know i is a number between 38 and 1, it is valid.
if i < 23 then
-- if Size is below 23 the same process happens to RiseVelocity, right?
-- But what about i = 38, is the script ignoring this part because you defined RiseVelocity before?
--The same process happens to RiseVelocity when i is less than 23. The script does ignore this part when the
--condition (i < 23) is false. If statement only continue if the condition is true.
S.RiseVelocity = i
-- Does Size get disabled or does i work for Size and RiseVelocity now?
--Since Size has been changed already, it stays its changed value. RiseVelocity is changing now, because we know i < 23.
|
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
Also, I did NOT use any tables. There was a better way using a numeric for loop.
If you want to learn about tables, let me know. I may be able to come up with a small tutorial. |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
Thanks for the explanation =P I've understood everything after reading it a couple of times. Maybe I'll ask you about tables later, I'm writing down your name, I'll ask you when I need help with tables / When I need them.
I'm working on a Build, Fight and Life place since I dont like the current ones. |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
Oh; One last question: Whats 'Deb' for, could you explain to me, please? |
|
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
I use it as a debounce to prevent the same thing happening again before the first one finishes. |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
What is that for? |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
Ah, right. Ive seen this with "Enabled = true / false" before. |
|
AgentFirefoxTop 100 PosterJoin Date: 2008-06-20 Post Count: 22404 |
It's the same concept. ^_^ |
|
|
how do u script send me a pm plz be my script teatcher and if i were bc but im not i would donate to u |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
I've been trying the script now; The deb part does not work. Any fix? |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
Whats wrong with the deb part. Its just not de-enabling the function of touching. |
|
MHXJoin Date: 2008-12-08 Post Count: 2049 |
Okay; Other question:
How to disable the script when it starts and enable it when it ends, so the script cant run twice at the same time. |
|