Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.12 KB | None | 0 0
  1. -- Instructions:
  2. --[[
  3. Any local variables with :
  4. = LocalPlayer:
  5. Must be replaced with "owner". So if your local variable is game.Players.LocalPlayer , replace it with owner
  6. = :GetMouse():
  7. Remove the variable entirely.
  8.  
  9. then paste this over the desired script
  10. --]]
  11.  
  12. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  13. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  14. do
  15. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  16. script.Parent = Player.Character
  17.  
  18. --RemoteEvent for communicating
  19. local Event = Instance.new("RemoteEvent")
  20. Event.Name = "UserInput_Event"
  21. --Fake event to make stuff like Mouse.KeyDown work
  22. local function fakeEvent()
  23. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  24. t.connect = t.Connect
  25. return t
  26. end
  27. --Creating fake input objects with fake variables
  28. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  29. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  30. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  31. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  32. end}
  33. --Merged 2 functions into one by checking amount of arguments
  34. CAS.UnbindAction = CAS.BindAction
  35.  
  36. --This function will trigger the events that have been :Connect()'ed
  37. local function te(self,ev,...)
  38. local t = m[ev]
  39. if t and t._fakeEvent and t.Function then
  40. t.Function(...)
  41. end
  42. end
  43. m.TrigEvent = te
  44. UIS.TrigEvent = te
  45. Event.OnServerEvent:Connect(function(plr,io)
  46. if plr~=Player then return end
  47. if io.isMouse then
  48. m.Target = io.Target
  49. m.Hit = io.Hit
  50. else
  51. local b = io.UserInputState == Enum.UserInputState.Begin
  52. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  53. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  54. end
  55. for _,t in pairs(CAS.Actions) do
  56. for _,k in pairs(t.Keys) do
  57. if k==io.KeyCode then
  58. t.Function(t.Name,io.UserInputState,io)
  59. end
  60. end
  61. end
  62. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  63. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  64. end
  65. end)
  66. Event.Parent = NLS([==[
  67. local Player = owner
  68. local Event = script:WaitForChild("UserInput_Event")
  69. local UIS = game:GetService("UserInputService")
  70. local input = function(io,a)
  71. if a then return end
  72. --Since InputObject is a client-side instance, we create and pass table instead
  73. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  74. end
  75. UIS.InputBegan:Connect(input)
  76. UIS.InputEnded:Connect(input
  77. local h,t
  78. --Give the server mouse data 30 times every second, but only if the values changed
  79. --If player is not moving their mouse, client won't fire events
  80. while wait(1/30) do
  81. if h~=Mouse.Hit or t~=Mouse.Target then
  82. h,t=Mouse.Hit,Mouse.Target
  83. Event:FireServer({isMouse=true,Target=t,Hit=h})
  84. end
  85. end]==],Player.Character)
  86. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  87. end
  88. -- End of FE converter
  89. local char = owner.Character
  90. mouse.KeyDown:Connect(function(key)
  91. if key=="q" then
  92. if char:FindFirstChildWhichIsA("Shirt") then
  93. if mouse.Target.Parent:FindFirstChildWhichIsA("Shirt") then
  94. char:FindFirstChildWhichIsA("Shirt").ShirtTemplate = mouse.Target.Parent:FindFirstChildWhichIsA("Shirt").ShirtTemplate
  95. print("Got "..mouse.Target.Parent.Name.."'s Shirt. AssetID = "..mouse.Target.Parent:FindFirstChildWhichIsA("Shirt").ShirtTemplate)
  96. elseif mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Shirt") then
  97. char:FindFirstChildWhichIsA("Shirt").ShirtTemplate = mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Shirt").ShirtTemplate
  98. print("Got "..mouse.Target.Parent.Parent.Name.."'s Shirt. AssetID = "..mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Shirt").ShirtTemplate)
  99. else
  100. print("Either the mouse pointed at a non-player,")
  101. print("or the mouse pointed at a player with no")
  102. print("shirt.")
  103. end
  104. else
  105. if mouse.Target.Parent:FindFirstChildWhichIsA("Shirt") then
  106. print("You have no shirt, making you a shirt.")
  107. print("Got "..mouse.Target.Parent.Name.."'s Shirt. AssetID = "..mouse.Target.Parent:FindFirstChildWhichIsA("Shirt").ShirtTemplate)
  108. local Cshirt = mouse.Target.Parent:FindFirstChildWhichIsA("Shirt"):Clone()
  109. Cshirt.Parent = char
  110. elseif mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Shirt") then
  111. local Cshirt = mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Shirt"):Clone()
  112. Cshirt.Parent = char
  113. print("Got "..mouse.Target.Parent.Parent.Name.."'s Shirt. AssetID = "..mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Shirt").ShirtTemplate)
  114. else
  115. print("Either the mouse pointed at a non-player,")
  116. print("or the mouse pointed at a player with no")
  117. print("shirt.")
  118. end
  119. end
  120. elseif key=="e" then
  121. if char:FindFirstChildWhichIsA("Pants") then
  122. if mouse.Target.Parent:FindFirstChildWhichIsA("Pants") then
  123. char:FindFirstChildWhichIsA("Pants").PantsTemplate = mouse.Target.Parent:FindFirstChildWhichIsA("Pants").PantsTemplate
  124. print("Got "..mouse.Target.Parent.Name.."'s Pants. AssetID = "..mouse.Target.Parent:FindFirstChildWhichIsA("Pants").PantsTemplate)
  125. elseif mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Pants") then
  126. char:FindFirstChildWhichIsA("Pants").PantsTemplate = mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Pants").PantsTemplate
  127. print("Got "..mouse.Target.Parent.Parent.Name.."'s Pants. AssetID = "..mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Pants").PantsTemplate)
  128. else
  129. print("Either the mouse pointed at a non-player,")
  130. print("or the mouse pointed at a player with no")
  131. print("pants.")
  132. end
  133. else
  134. if mouse.Target.Parent:FindFirstChildWhichIsA("Shirt") then
  135. print("You have no pants, making you pants.")
  136. print("Got "..mouse.Target.Parent.Name.."'s Pants. AssetID = "..mouse.Target.Parent:FindFirstChildWhichIsA("Pants").PantsTemplate)
  137. local Cshirt = mouse.Target.Parent:FindFirstChildWhichIsA("Pants"):Clone()
  138. Cshirt.Parent = char
  139. elseif mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Pants") then
  140. local Cshirt = mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Pants"):Clone()
  141. Cshirt.Parent = char
  142. print("Got "..mouse.Target.Parent.Parent.Name.."'s Pants. AssetID = "..mouse.Target.Parent.Parent:FindFirstChildWhichIsA("Pants").PantsTemplate)
  143. else
  144. print("Either the mouse pointed at a non-player,")
  145. print("or the mouse pointed at a player with no")
  146. print("pants.")
  147. end
  148.  
  149. end
  150. end
  151. end)
  152. print("Loaded Clothing Cloner:")
  153. print("Q for shirts.")
  154. print("E for pants.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement