Urbanpower

Charecter Creator Script

Jul 15th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.70 KB | None | 0 0
  1. --[[
  2. Made by Rouxhaver
  3.  
  4. showcase: https://www.youtube.com/watch?v=KpjGbXuMbk8
  5. R and T to rotate,
  6. drag floor to change hip height,
  7. select body part on the right.
  8.  
  9. ]]
  10.  
  11. player = game:GetService("Players").LocalPlayer
  12. camera = workspace.CurrentCamera
  13. character = player.Character
  14. mouse = player:GetMouse()
  15.  
  16. for i,v in pairs(game:GetService("Lighting"):GetChildren()) do
  17. v:Destroy()
  18. end
  19.  
  20. temp = Instance.new("Folder",workspace)
  21.  
  22. stuff = Instance.new("Folder",temp)
  23.  
  24. camera.CameraType = Enum.CameraType.Scriptable
  25. camera.FieldOfView = 1
  26.  
  27. cenoff = 1000
  28.  
  29. camera.CFrame = CFrame.new(-5,cenoff,-1500) * CFrame.Angles(0,math.rad(180),0)
  30.  
  31. background = Instance.new("Part",temp)
  32. background.Anchored = true
  33. background.Size = Vector3.new(100,100,0.1)
  34. background.Position = Vector3.new(0,cenoff,0)
  35. background.Color = Color3.new(0.0941176, 0.952941, 1)
  36.  
  37. hipheight = 0
  38.  
  39. ground = Instance.new("Part",temp)
  40. ground.Anchored = true
  41. ground.Size = Vector3.new(100,100,0.11)
  42. ground.Position = Vector3.new(0,cenoff-53,0)
  43. ground.Color = Color3.new(0.105882, 0.576471, 0.0705882)
  44.  
  45. referance = game:GetObjects("rbxassetid://13540732616")[1]
  46. referance.Parent = temp
  47. referance.HumanoidRootPart.CFrame = CFrame.new(0,cenoff,0)
  48.  
  49. SG = Instance.new("ScreenGui",player.PlayerGui)
  50. SG.IgnoreGuiInset = true
  51.  
  52. uiback = Instance.new("Frame",SG)
  53. uiback.AnchorPoint = Vector2.new(1,0)
  54. uiback.Position = UDim2.new(1)
  55. uiback.Size = UDim2.new(0.25,0,1)
  56. uiback.BorderMode = Enum.BorderMode.Inset
  57. uiback.BorderSizePixel = 10
  58. uiback.BorderColor3 = Color3.new(0,0,0)
  59. uiback.BackgroundColor3 = Color3.new(0.290196, 0.290196, 0.290196)
  60.  
  61. hatname = Instance.new("TextLabel",uiback)
  62. hatname.AnchorPoint = Vector2.new(.5,.5)
  63. hatname.Position = UDim2.new(.5,0,.1)
  64. hatname.Size = UDim2.new(.95,0,.1)
  65. hatname.TextScaled = true
  66. hatname.BackgroundTransparency = 1
  67. hatname.TextColor3 = Color3.new(0,0,0)
  68. hatname.Text = "Hat Name"
  69.  
  70. button = Instance.new("TextButton")
  71. button.Size = UDim2.new(1,0,.1)
  72. button.TextScaled = true
  73. button.BorderMode = Enum.BorderMode.Inset
  74. button.TextColor3 = Color3.new(0,0,0)
  75. button.BorderSizePixel = 10
  76. button.BorderColor3 = Color3.new(0,0,0)
  77. button.BackgroundColor3 = Color3.new(0.380392, 0.380392, 0.380392)
  78. Instance.new("UIStroke",button)
  79.  
  80. buttons = {}
  81.  
  82. buttons.RA = button:Clone()
  83. buttons.RA.Text = "Right Arm"
  84. buttons.RA.Parent = uiback
  85. buttons.RA.Position = UDim2.new(0,0,0.2)
  86. buttons.RA.TextColor3 = Color3.fromRGB(237, 234, 234)
  87.  
  88. buttons.RL = button:Clone()
  89. buttons.RL.Text = "Right Leg"
  90. buttons.RL.Parent = uiback
  91. buttons.RL.Position = UDim2.new(0,0,0.3)
  92. buttons.RL.TextColor3 = Color3.fromRGB(170, 85, 0)
  93.  
  94. buttons.LA = button:Clone()
  95. buttons.LA.Text = "Left Arm"
  96. buttons.LA.Parent = uiback
  97. buttons.LA.Position = UDim2.new(0,0,0.4)
  98. buttons.LA.TextColor3 = Color3.fromRGB(255, 0, 0)
  99.  
  100. buttons.LL = button:Clone()
  101. buttons.LL.Text = "Left Leg"
  102. buttons.LL.Parent = uiback
  103. buttons.LL.Position = UDim2.new(0,0,0.5)
  104. buttons.LL.TextColor3 = Color3.fromRGB(255, 255, 0)
  105.  
  106. buttons.HD = button:Clone()
  107. buttons.HD.Text = "Head"
  108. buttons.HD.Parent = uiback
  109. buttons.HD.Position = UDim2.new(0,0,0.6)
  110. buttons.HD.TextColor3 = Color3.fromRGB(0, 255, 0)
  111.  
  112. buttons.TS = button:Clone()
  113. buttons.TS.Text = "Torso"
  114. buttons.TS.Parent = uiback
  115. buttons.TS.Position = UDim2.new(0,0,0.7)
  116. buttons.TS.TextColor3 = Color3.fromRGB(255, 0, 191)
  117.  
  118. buttons.RP = button:Clone()
  119. buttons.RP.Text = "Root Part"
  120. buttons.RP.Parent = uiback
  121. buttons.RP.Position = UDim2.new(0,0,0.8)
  122.  
  123. Create = button:Clone()
  124. Create.Text = "Create"
  125. Create.Parent = uiback
  126. Create.Position = UDim2.new(0,0,0.9)
  127. Create.BackgroundColor3 = Color3.new(0.133333, 1, 0)
  128.  
  129. credote = Instance.new("TextLabel",SG)
  130. credote.AnchorPoint = Vector2.new(0,1)
  131. credote.Position = UDim2.new(0,0,1)
  132. credote.Size = UDim2.new(.3,0,.075)
  133. credote.Text = "Made by Rouxhaver"
  134. credote.TextScaled = true
  135. credote.BackgroundTransparency = 1
  136. credote.TextColor3 = Color3.new(0,0,0)
  137.  
  138. outline = Instance.new("Highlight",nil)
  139. outline.OutlineColor = Color3.new(1, 0.623529, 0.0941176)
  140.  
  141. selhat = nil
  142.  
  143. handles = {}
  144.  
  145. for i,hat in pairs(character:GetChildren()) do
  146. if hat:IsA("Accessory") then
  147. local part = hat.Handle:Clone()
  148. table.insert(handles, part)
  149. part.Parent = stuff
  150. part.Anchored = true
  151. part.AccessoryWeld:Destroy()
  152. part.CFrame = CFrame.new(math.random(-100,100)/10,cenoff+math.random(-100,100)/10,-10)
  153.  
  154. local limb = Instance.new("StringValue",part)
  155. limb.Value = "RP"
  156. limb.Name = "limb"
  157.  
  158. local pos = Instance.new("Vector3Value",part)
  159. pos.Name = "pos"
  160. pos.Value = part.Position
  161.  
  162. local hatval = Instance.new("ObjectValue",part)
  163. hatval.Name = "hatval"
  164. hatval.Value = hat
  165.  
  166. local rot = Instance.new("Vector3Value",part)
  167. rot.Name = "rot"
  168. rot.Value = Vector3.new()
  169. end
  170. end
  171.  
  172. dragging = false
  173.  
  174. function clearcolor()
  175. for i,v in pairs(buttons) do
  176. v.BackgroundColor3 = Color3.new(0.380392, 0.380392, 0.380392)
  177. end
  178. end
  179.  
  180. mouse.Button1Down:Connect(function()
  181. if mouse.Target and mouse.Target.Parent == stuff then
  182. clearcolor()
  183. selhat = mouse.Target
  184. outline.Parent = selhat
  185. hatname.Text = selhat.hatval.Value.Name
  186. dragging = true
  187. mouse.TargetFilter = stuff
  188. buttons[selhat.limb.Value].BackgroundColor3 = Color3.new(0.94902, 1, 0)
  189. while dragging == true do
  190. selhat.Position = mouse.Hit.p + Vector3.new(0,0,-10)
  191. task.wait()
  192. end
  193. selhat.pos.Value = mouse.Hit.p
  194. end
  195. if mouse.Target == ground then
  196. dragging = true
  197. while dragging == true do
  198. ground.Position = Vector3.new(0,mouse.Hit.Y-50,0)
  199. hipheight = cenoff - mouse.Hit.Y - 3
  200. task.wait()
  201. end
  202. end
  203. end)
  204.  
  205. mouse.Button1Up:Connect(function()
  206. dragging = false
  207. mouse.TargetFilter = nil
  208. end)
  209.  
  210. for i,v in pairs(buttons) do
  211. v.MouseButton1Up:Connect(function()
  212. if selhat ~= nil then
  213. clearcolor()
  214. selhat.limb.Value = tostring(i)
  215. v.BackgroundColor3 = Color3.new(0.94902, 1, 0)
  216. end
  217. end)
  218. end
  219.  
  220. usimp = game:GetService("UserInputService")
  221.  
  222. usimp.InputBegan:Connect(function(key)
  223. if selhat ~= nil then
  224. if key.KeyCode == Enum.KeyCode.R then
  225. selhat.Orientation += Vector3.new(0,10,0)
  226. selhat.rot.Value = selhat.Orientation
  227. end
  228. if key.KeyCode == Enum.KeyCode.T then
  229. selhat.Orientation += Vector3.new(0,0,10)
  230. selhat.rot.Value = selhat.Orientation
  231. end
  232. end
  233. end)
  234.  
  235. ts = game:GetService("TweenService")
  236.  
  237. function createtween(part, cframe,ttime)
  238. local tweeninfo = TweenInfo.new(ttime)
  239. local tween = ts:Create(part, tweeninfo, {CFrame = cframe})
  240. tween:Play()
  241. end
  242.  
  243. Create.MouseButton1Up:Connect(function()
  244. SG:Destroy()
  245. local newchar = referance:Clone()
  246. local hrp = newchar.HumanoidRootPart
  247. hrp.Anchored = false
  248. hrp.CFrame = character.HumanoidRootPart.CFrame
  249. newchar.Parent = workspace
  250. newchar.Humanoid.HipHeight = hipheight
  251.  
  252. player.Character = newchar
  253.  
  254. local animate = character.Animate:Clone()
  255. animate.Parent = newchar
  256.  
  257. camera.CameraType = Enum.CameraType.Custom
  258. camera.CameraSubject = newchar.Humanoid
  259. camera.FieldOfView = 70
  260.  
  261. wait(game:GetService("Players").RespawnTime+.3)
  262.  
  263. character.Humanoid.Health = 0
  264.  
  265. for i,v in pairs(newchar:GetChildren()) do
  266. if v:IsA("BasePart") then
  267. v.Transparency = 1
  268. end
  269. end
  270.  
  271. newchar.Head.face:Destroy()
  272.  
  273. for i,handle in pairs(handles) do
  274. local hat = handle.hatval.Value.Handle
  275. local limb = nil
  276. local pos = nil
  277. local rot = handle.rot.Value
  278. if handle.limb.Value == "RA" then
  279. limb = newchar["Right Arm"]
  280. pos = handle.pos.Value - referance["Right Arm"].Position
  281. end
  282. if handle.limb.Value == "LA" then
  283. limb = newchar["Left Arm"]
  284. pos = handle.pos.Value - referance["Left Arm"].Position
  285. end
  286. if handle.limb.Value == "RL" then
  287. limb = newchar["Right Leg"]
  288. pos = handle.pos.Value - referance["Right Leg"].Position
  289. end
  290. if handle.limb.Value == "LL" then
  291. limb = newchar["Left Leg"]
  292. pos = handle.pos.Value - referance["Left Leg"].Position
  293. end
  294. if handle.limb.Value == "TS" then
  295. limb = newchar["Torso"]
  296. pos = handle.pos.Value - referance["Torso"].Position
  297. end
  298. if handle.limb.Value == "RP" then
  299. limb = newchar["HumanoidRootPart"]
  300. pos = handle.pos.Value - referance["HumanoidRootPart"].Position
  301. end
  302. if handle.limb.Value == "HD" then
  303. limb = newchar["Head"]
  304. pos = handle.pos.Value - referance["Head"].Position
  305. end
  306. coroutine.wrap(function()
  307. while true do
  308. local thecframe = (limb.CFrame + (limb.CFrame.RightVector * pos.X) + (limb.CFrame.UpVector * pos.Y)) * CFrame.Angles(0,math.rad(rot.Y),math.rad(rot.Z))
  309. createtween(hat, thecframe, 0)
  310. hat.AssemblyLinearVelocity = Vector3.new(0,30,0)
  311. task.wait()
  312. end
  313. end)()
  314. end
  315. temp:Destroy()
  316. selhat = nil
  317. while task.wait() do
  318. if newchar.Humanoid.Health == 0 then
  319. player.Character = character
  320. end
  321. end
  322. end)
Add Comment
Please, Sign In to add comment