Jump to content

Reset player after finishing ragdoll


Yue
 Share

Recommended Posts



I am trying to restart the player after his death to a specific point on the map, as you can't create an animation to make him stand up, but this doesn't work for me, after deleting the character and creating a new one about three times this gets very slow.

 

function this:Update()
		

		

		if Window:GetCurrent():KeyHit(Key.R) then 
			if self.r == false then 
								
				self.player2 =  self.player:Instance(),"Yue"		
				
				self.player:StopAnimation()
				self:SetPositionMeshs()
				self:SetRotationMeshs()
				self:SetParent(true)
				self:CreateJoints()
				self:SetMass(1.0)
				
				

				
				self.r = true
			end	
		end


		if self.r == true then 	
			--self:UpdateBones()
			
			if Window:GetCurrent():KeyHit(Key.T) then
				self:SetParent(false)
				self.player:Release()
				self.player = self.player2
				--self.player2:Release()
				
				--self.r=false

			end
		end



	end

I think the truth is that I'm a very bad programmer and I'm going to give up on this, I always run into certain difficult obstacles and the same process and get nowhere.

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

Don't give up ?. Programming is about running into difficulties and problem sometimes. You need to planned out what you need and how you can do it before hand to avoid problems, but you will eventually run into something that will give you a hard time if you are working on a big script.

To answer your problem, on this forum post (

) reepblue gave a code snippet of a character controller with a respawn function. Here is the direct link to the comment with the code in it.

Hope it will help you with your problem?.

  • Like 1

Just making games for fun. Currently working on T3-L4

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...