|
| 16 Mar 2013 09:28 AM |
How do I take this kill script:
function onButtonClicked() script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 end
script.Parent.MouseButton1Click:connect(onButtonClicked)
And turn it into a respawn script, opposed to killing the player? |
|
|
| Report Abuse |
|
|
iLikePHP
|
  |
| Joined: 24 Feb 2013 |
| Total Posts: 372 |
|
|
| 16 Mar 2013 09:31 AM |
Umm You could do... function onClicked() local name = script.Parent.Parent.Parent.Parent.Parent.Name local person = game.Workspace:FindFirstChild(name) person.Position = Vector3.new(0,0,0) -- Put the vector3 position of the spawn here end script.Parent.MouseButton1Down:connect(onClicked)
That should work... { iLikePHP("official"); } |
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
| |
|
Zulsoras
|
  |
| Joined: 10 Sep 2008 |
| Total Posts: 963 |
|
|
| 16 Mar 2013 09:31 AM |
| Wish i saw this a minute earlier just had my own respawn script open. Dont know off the top of my head though |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2013 09:33 AM |
So could I do:
function onButtonClicked() script.Parent.Parent.Parent.Parent.Parent.Character:LoadCharacter(true) end
script.Parent.MouseButton1Click:connect(onButtonClicked)
or would it be wrong? |
|
|
| Report Abuse |
|
|
iLikePHP
|
  |
| Joined: 24 Feb 2013 |
| Total Posts: 372 |
|
|
| 16 Mar 2013 09:33 AM |
I don't know, I only know a little Lua. { iLikePHP("official"); } |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2013 09:34 AM |
| I'll test it out and see if anything happens. |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 16 Mar 2013 09:35 AM |
function onButtonClicked() player = script.Parent.Parent.Parent.Parent.Parent. local ack2 = Instance.new("Model") ack2.Parent = game.Workspace local ack4 = Instance.new("Part") ack4.Transparency = 1 ack4.CanCollide = false ack4.Anchored = true ack4.Name = "Torso" ack4.Position = Vector3.new(10000,10000,10000) ack4.Parent = ack2 local ack3 = Instance.new("Humanoid") ack3.Torso = ack4 ack3.Parent = ack2 player.Character = ack2 end script.Parent.MouseButton1Click:connect(onButtonClicked)
Just took a chunk from Person299's Admin Commands and stuck it here. Dunno if it will work. |
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
|
| 16 Mar 2013 09:37 AM |
local name = script.Parent.Parent.Parent.Parent.Parent local player = game.Players:FindFirstChild(name) player:LoadCharacter(true)
put that in your button |
|
|
| Report Abuse |
|
|
| |
|
| |
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 16 Mar 2013 09:38 AM |
OH MY GOD LOSERS:
function onButtonClicked() script.Parent.Parent.Parent.Parent.Parent:LoadCharacter() end
script.Parent.MouseButton1Click:connect(onButtonClicked)
THATS HOW WE USE LOADCHARACTER |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 16 Mar 2013 09:40 AM |
uhh, i guess you can just make the player teleport to the spawn location?
If the above script does work as in killing then you can write it in this way:
button = script.Parent
button.MouseButton1Click:connect(function() button.Parent.Parent.Parent.Parent.Character.Torso.CFrame = button.Parent.Parent.Parent.Parent.Character.Torso.CFrame.new(SPAWN.LOCATION) end)
have no idea why so many parents, but heres a shorter way if it only has 2 parents:
button = script.Parent
button.MouseButton1Click:connect(function() button.Parent.Character.Torso.CFrame = button.Parent.Character.Torso.CFrame.new(Pos) end)
This should work because the first line already connects with the function so you don't have to connect it at the end of the script, its pretty much the same but i like to use this method for smaller like scripts!
If you want to use your method: (with 2 parents)
button = script.Parent
function onButtonClicked() button.Parent.Chaacter.Torso.CFrame = button.Parent.Character.Torso.CFrame.new(Pos) end
button.MouseButton1Click:connect(onButtonClicked)
I tried to write it in every way for you to make it easier, to be honest, i don't even know if that would work, might not have to show the parents again after the "=" after CFrame...
I dont know if you really did want to make the player teleport opposed to killing the player then my bad, just trying to help :) |
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
|
| 16 Mar 2013 09:41 AM |
| If you put true in the parentheses then the loading time is much lowered |
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
|
| 16 Mar 2013 09:42 AM |
| :LoadCharacter() doesn't kill the player.... it justs reloads him.... |
|
|
| Report Abuse |
|
|
gamert7
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 16 Mar 2013 09:46 AM |
I have never seen a worse attempt by all these scripters in my life... Anyways here is what you wanted:
local plr=game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function() --Assuming this is a gui.
plr.Character.Health=0
end) --Was that so hard? |
|
|
| Report Abuse |
|
|
gamert7
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 16 Mar 2013 09:47 AM |
| plr.Character.Humanoid.Health=0* |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 16 Mar 2013 09:49 AM |
@gamert7
if you have read it right, he said "Opposed to killing" that means he doesn't want the player to die but actually respawn without having to kill the player... the way you just wrote it is the same the forum poster did, except the fact you used the short function method...
next time, try reading before you call anyone else a horrible scripter. |
|
|
| Report Abuse |
|
|
gamert7
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 16 Mar 2013 09:50 AM |
| I never called anybody horrible I misread what he wanted. |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 16 Mar 2013 09:51 AM |
@Answer to people who asked about my comment, It's the respawn/PLAYER command from Person299's admin commands but edited and stuck in a button. |
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
|
| 16 Mar 2013 09:52 AM |
@Gamer
Dude, it's a NON-KILLING script. All the scripts here would have worked the way the asker would have wanted, EXCEPT for yours. Who's pathetic now? |
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
|
| 16 Mar 2013 09:52 AM |
@Mark
It was very wierdly written lolol |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 16 Mar 2013 09:57 AM |
@Sammy, I know it was but it worked. XD
|
|
|
| Report Abuse |
|
|
sammy1229
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 669 |
|
| |
|