of     1   

ajm1996
Top 100 Poster
#703359Friday, April 04, 2008 12:59 AM GMT

Can you please edit this script I need it right away for my place. The problem is that it only works once, and then when I try it again it won't work, and I have to get off and back on for it to work. Here it is: function onTouched(hit) building = game.Workspace.Building1.side1 backup = game.Workspace.Building1.side1:clone() building:remove() wait(3) building = backup:clone() building.Parent = game.Workspace.Building1 building.Name = "side1" building.Anchored = true building.Locked = false model:makeJoints() end script.Parent.Touched:connect(onTouched)
ajm1996
Top 100 Poster
#707089Friday, April 04, 2008 8:02 PM GMT

please help I need to finish my place.
koopa
#707426Friday, April 04, 2008 8:38 PM GMT

I would try something more like this: -------------------- backup = game.Workspace.Building1.side1:clone() function onTouched(hit) game.Workspace.Building1.side1:remove() wait(3) building = backup:clone() building.Parent = game.Workspace.Building1 building.Name = "side1" building.Anchored = true building.Locked = false building:makeJoints() end script.Parent.Touched:connect(onTouched) ----------------------- I would have the lines that states what backup is outside of the onTouched function. If you have it inside the onTouched function then it will only do that when touched. So it will create a clone of side1 when it has been touched. If you keep it outside of that then as soon as the game starts it already has a copy of it. It is really up to you though. I find that doing that keeps it a little simpler, and works in more situations. I think the problem with the script was actually your last statement before the end of the onTouched function. You had "model:makeJoints()" At that point model wasn't anything since you didn't make it anything. Thus it would break at that line. Koopa
ajm1996
Top 100 Poster
#709341Saturday, April 05, 2008 1:12 AM GMT

I already tried it without the model:makeJoints() and it didn't work I replaced my with yours but it still only works once.
ajm1996
Top 100 Poster
#709347Saturday, April 05, 2008 1:12 AM GMT

I'm getting frustrated this stupid thing won't work!
ajm1996
Top 100 Poster
#709471Saturday, April 05, 2008 1:32 AM GMT

Please help and if yours works and your in the builders club I will pay you 50 tixs.
koopa
#709705Saturday, April 05, 2008 2:00 AM GMT

I have a question. Is your model already locked and anchored? The one that you are cloning? And since it is actually already named side1 you could just have it like... -------------------- backup = game.Workspace.Building1.side1:clone() function onTouched(hit) game.Workspace.Building1.side1:remove() wait(3) building = backup:clone() building.Parent = game.Workspace.Building1 building:makeJoints() end script.Parent.Touched:connect(onTouched) ----------------------- Koopa
ajm1996
Top 100 Poster
#709778Saturday, April 05, 2008 2:10 AM GMT

I think it's anchored and it's not lock but I just put that in case. I will try yours tomorrow I have to go to bed.
ajm1996
Top 100 Poster
#709812Saturday, April 05, 2008 2:15 AM GMT

It didn't work.
CoolJB
#709822Saturday, April 05, 2008 2:17 AM GMT

backup = game.Workspace.Building1.side1:clone() function onTouched(hit) local human = hit.Parent:findFirstChild("Humanoid") if human ~= nil then game.Workspace.Building1.side1:remove() wait(3) building = backup:clone() building.Parent = game.Workspace.Building1 building:makeJoints() end script.Parent.Touched:connect(onTouched) ------------------------------------------------------------------------ Um...Humanoid? C=CoolJB=C (It might work.)
CoolJB
#709836Saturday, April 05, 2008 2:18 AM GMT

I forgotted to put a second end,the if action.
ajm1996
Top 100 Poster
#711453Saturday, April 05, 2008 11:51 AM GMT

where do you put the if action
ajm1996
Top 100 Poster
#711462Saturday, April 05, 2008 11:55 AM GMT

That only work once too.
ajm1996
Top 100 Poster
#711500Saturday, April 05, 2008 12:05 PM GMT

can I make it so it deletes the script and then clones it so it's just like I quit and got back on.
koopa
#711766Saturday, April 05, 2008 12:56 PM GMT

Ok, so i know what your problem is now. I thought it was a error inside the script. So, i'll tell you what is going on. When you touch the brick it does the onTouched function because that is what we have it set to do. Now the problem is what happens if we touch the brick again, while it is still doing onTouched function for the last time we touched it? The script would break when it tried to remove side1 from the game because it could no longer find side1. It could no longer find side1 because on our last touch we had already removed it. To fix a problem like this you can just add a debounce. ----------------------- backup = game.Workspace.Building1.side1:clone() debounce = false function onTouched(hit) if debounce == false then debounce = true game.Workspace.Building1.side1:remove() wait(3) building = backup:clone() building.Parent = game.Workspace.Building1 building.Name = "side1" building.Anchored = true building.Locked = false building:makeJoints() debounce = false end end script.Parent.Touched:connect(onTouched) ------------------------- So the debounce only allows the onTouched function to start up again after the last one has ended. By using this it will always be able to find side1. Koopa
dogsrock923
#711787Saturday, April 05, 2008 1:01 PM GMT

while true do -- Infinate Loop might go more than once. :P backup = game.Workspace.Building1.side1:clone() function onTouched(hit) game.Workspace.Building1.side1:remove() wait(3) building = backup:clone() building.Parent = game.Workspace.Building1 building.Name = "side1" building.Anchored = true building.Locked = false building:makeJoints() end script.Parent.Touched:connect(onTouched) ________________________________________ Try that.
ajm1996
Top 100 Poster
#712482Saturday, April 05, 2008 3:18 PM GMT

It didn't work koopa and I thought you said not to put in building:MakeJoints
koopa
#712547Saturday, April 05, 2008 3:30 PM GMT

Hmm... I tried it out, works fine for me. Did you use my script or Dogsrocks' script? His script will not work. No, having the building:makeJoints() is fine. You will most likely need that unless the model is anchored to begin with. Koopa
ajm1996
Top 100 Poster
#712980Saturday, April 05, 2008 4:35 PM GMT

it is anchored I think and it won't work for me idk y.
ajm1996
Top 100 Poster
#717174Sunday, April 06, 2008 1:44 AM GMT

koppa how about I make it a public model for a littel bit until u fix it and then you make it a public model and then delete it later?
ajm1996
Top 100 Poster
#720440Sunday, April 06, 2008 5:20 PM GMT

will you koopa?
slicergolden
#720857Sunday, April 06, 2008 6:15 PM GMT

umm arent u forgeting debounce?
ajm1996
Top 100 Poster
#723136Sunday, April 06, 2008 11:54 PM GMT

koopa suggested that but it won't work.

    of     1