|
Ok, with this styled script, let me explane. Touch, gui: "Hello" or whatever, click, and you teleport, that one has no problems. This one doesnt either (look below) the thing is, after using it maybe 2-3 times it suddenly breaks. So I added the regen part into the script, still didnt work. I want to know if theres any loose ends, or probblems with using scripts like these in games. It works fine in a server, but not an online server with other players and such. Help?
script:
clone = script:clone()
clone2 = script.Parent.ObservationGui2:clone()
me = script
me2 = script.Parent.ObservationGui2
debounce = false
function onTouched(part)
h=part.Parent:findFirstChild("Humanoid")
if h~=nil and debounce == false then
debounce = true
local OG1 = script.Parent.ObservationGui2:clone()
play = game.Players:playerFromCharacter(part.Parent)
OG1.Parent = play.PlayerGui
wait()
if play.PlayerGui:findFirstChild("ObservationGui2") ~= nil then
part.Parent.Torso.CFrame=CFrame.new((game.Workspace.PlyrTele2.Position.X), (game.Workspace.PlyrTele2.Position.Y+3), (game.Workspace.PlyrTele2.Position.Z))
h.WalkSpeed=0
clone.Parent = script.Parent
clone.Name = "Script"
clone2.Parent = script.Parent
clone2.Name = "ObservationGui2"
wait(0.1)
me2:Remove()
me:Remove()
debounce = false
end
end
end
script.Parent.Touched:connect(onTouched) |
|
|
Can no one help or something? |
|
|
Please help! Its very important! |
|
|
Wow. I even tried being polite. |
|
SDuke524Join Date: 2008-07-29 Post Count: 6267 |
Try using :findFirstChild() on things like your teleport brick. This always happens to me whenever I don't identify everything with :findFirstChild() at least once it'll break by saying that it's nil. I don't know why I guess just outta lazyness but this is what it does to me. |
|
|
Would this work better?
clone = script:clone()
clone2 = script.Parent.ObservationGui2:clone()
me = script
me2 = script.Parent.ObservationGui2
debounce = false
function onTouched(part)
h=part.Parent:findFirstChild("Humanoid")
if h~=nil and debounce == false then
debounce = true
local OG1 = script.Parent.ObservationGui2:clone()
play = game.Players:playerFromCharacter(part.Parent)
OG1.Parent = play:findFirstChild("PlayerGui")
wait()
if play.PlayerGui:findFirstChild("ObservationGui2") ~= nil then
Torso = part.Parent:findFirstChild("Torso")
Torso.CFrame=CFrame.new((game.Workspace.PlyrTele2.Position.X), (game.Workspace.PlyrTele2.Position.Y+3), (game.Workspace.PlyrTele2.Position.Z))
h.WalkSpeed=0
clone.Parent = script.Parent
clone2.Parent = script.Parent
if clone2.Parent ~= nil and clone.Parent ~= nil then
wait(0.1)
me2:Remove()
me:Remove()
debounce = false
end end
end
end
script.Parent.Touched:connect(onTouched) |
|
|
|
|
regsaJoin Date: 2008-09-12 Post Count: 309 |
What does it say when it crashes? |
|
|
OMG! I SAID THAT! JEEZ! IT DOESNT CRASH, IT FAILS TO WORK. JUST DOESNT WORK, YOU TOUCH IT NOTHING HAPPENS, I CANT CHECK THE OUTPUT, BECAUSE IT WORKS FINE, FOREVER, ITS ONLY INGAME THAT IT FAILS. JEEZ!!!!!!!!!!!! |
|
SDuke524Join Date: 2008-07-29 Post Count: 6267 |
clone = script:clone()
clone2 = script.Parent.ObservationGui2:clone()
me = script
me2 = script.Parent.ObservationGui2
debounce = false
script.Parent.Touched:connect(function(part)
h=part.Parent:findFirstChild("Humanoid")
if h~=nil and debounce == false then
debounce = true
OG1 = script.Parent.ObservationGui2:clone()
play = game.Players:GetPlayerFromCharacter(part.Parent)
OG1.Parent = play.PlayerGui -- if the computer knows it will be there as in it defines it ( properites etc. ) then you don't need it
Wait()
Torso = part.Parent:findFirstChild("Torso")
Torso.CFrame=CFrame.new((game.Workspace.PlyrTele2.Position.X), (game.Workspace.PlyrTele2.Position.Y+3), (game.Workspace.PlyrTele2.Position.Z))
h.WalkSpeed=0
clone.Parent = script.Parent
clone2.Parent = script.Parent
if clone2.Parent ~= nil and clone.Parent ~= nil then
wait(0.1)
me2:Remove()
me:Remove()
debounce = false
end end end end
) |
|
|
Sweetness!! You had one to many ends, but it works great! Thanks! |
|
|
|
|
Elite777Join Date: 2008-09-21 Post Count: 350 |
Please stop bumping you said that it was working erlier |
|
|
Didn't you read the OTHER post?
It sounded something like, STILL BREAKS!!! Did you think I was gonna bump a post when the script is fixed? I'm no idiot. Sheesh. |
|