SHOW:
|
|
- or go back to the newest paste.
1 | -- This script has been converted to FE by iPxter | |
2 | ||
3 | ||
4 | - | local char = game.Players.LocalPlayer.Character |
4 | + | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end |
5 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
6 | do | |
7 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter") | |
8 | script.Parent = Player.Character | |
9 | - | local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis. |
9 | + | |
10 | --RemoteEvent for communicating | |
11 | local Event = Instance.new("RemoteEvent") | |
12 | Event.Name = "UserInput_Event" | |
13 | ||
14 | --Fake event to make stuff like Mouse.KeyDown work | |
15 | local function fakeEvent() | |
16 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} | |
17 | t.connect = t.Connect | |
18 | return t | |
19 | end | |
20 | ||
21 | --Creating fake input objects with fake variables | |
22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
26 | end} | |
27 | --Merged 2 functions into one by checking amount of arguments | |
28 | CAS.UnbindAction = CAS.BindAction | |
29 | ||
30 | --This function will trigger the events that have been :Connect()'ed | |
31 | local function te(self,ev,...) | |
32 | local t = m[ev] | |
33 | if t and t._fakeEvent and t.Function then | |
34 | t.Function(...) | |
35 | end | |
36 | end | |
37 | m.TrigEvent = te | |
38 | UIS.TrigEvent = te | |
39 | ||
40 | Event.OnServerEvent:Connect(function(plr,io) | |
41 | if plr~=Player then return end | |
42 | if io.isMouse then | |
43 | m.Target = io.Target | |
44 | m.Hit = io.Hit | |
45 | else | |
46 | local b = io.UserInputState == Enum.UserInputState.Begin | |
47 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
48 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
49 | end | |
50 | for _,t in pairs(CAS.Actions) do | |
51 | for _,k in pairs(t.Keys) do | |
52 | if k==io.KeyCode then | |
53 | t.Function(t.Name,io.UserInputState,io) | |
54 | end | |
55 | end | |
56 | end | |
57 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
58 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
59 | end | |
60 | end) | |
61 | Event.Parent = NLS([==[ | |
62 | local Player = game:GetService("Players").LocalPlayer | |
63 | local Event = script:WaitForChild("UserInput_Event") | |
64 | ||
65 | local UIS = game:GetService("UserInputService") | |
66 | local input = function(io,a) | |
67 | if a then return end | |
68 | --Since InputObject is a client-side instance, we create and pass table instead | |
69 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) | |
70 | end | |
71 | UIS.InputBegan:Connect(input) | |
72 | UIS.InputEnded:Connect(input) | |
73 | ||
74 | local Mouse = Player:GetMouse() | |
75 | local h,t | |
76 | --Give the server mouse data 30 times every second, but only if the values changed | |
77 | --If player is not moving their mouse, client won't fire events | |
78 | while wait(1/30) do | |
79 | if h~=Mouse.Hit or t~=Mouse.Target then | |
80 | h,t=Mouse.Hit,Mouse.Target | |
81 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
82 | end | |
83 | end]==],Player.Character) | |
84 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
85 | end | |
86 | ||
87 | -- GPlayr by ModernLukest. Made for v3rmillion, , etc. | |
88 | -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do. | |
89 | ||
90 | local char = owner | |
91 | ||
92 | ||
93 | ||
94 | -- CREATING BUTTONS, LABELS, FRAMES, ETC. | |
95 | local gui = Instance.new("ScreenGui", game.Players.TinkerElsa44.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis. | |
96 | local openbtn = Instance.new("TextButton", gui) | |
97 | local closebtn = Instance.new("TextButton", gui) | |
98 | local openguibtn = Instance.new("TextButton", gui) | |
99 | local playmusicint = Instance.new("Frame", gui) | |
100 | local playmusicbtn = Instance.new("ImageButton", playmusicint) | |
101 | local stopmusicbtn = Instance.new("ImageButton", playmusicint) | |
102 | local musicidbox = Instance.new("TextBox", playmusicint) | |
103 | local credit = Instance.new("TextLabel", playmusicint) | |
104 | local title = Instance.new("TextLabel", playmusicint) | |
105 | ||
106 | -- SIZING -- | |
107 | ||
108 | openbtn.Size = UDim2.new(0, 100, 0, 50) | |
109 | closebtn.Size = UDim2.new(0, 100, 0, 50) | |
110 | openguibtn.Size = UDim2.new(0, 100, 0, 50) | |
111 | playmusicbtn.Size = UDim2.new(0, 50, 0, 50) | |
112 | stopmusicbtn.Size = UDim2.new(0, 57, 0, 57) | |
113 | musicidbox.Size = UDim2.new(0, 300, 0, 50) | |
114 | credit.Size = UDim2.new(0, 300, 0, 20) | |
115 | title.Size = UDim2.new(0, 300, 0, 30) | |
116 | playmusicint.Size = UDim2.new(0, 300, 0, 500) | |
117 | ||
118 | -- POSITIONING -- | |
119 | ||
120 | openbtn.Position = UDim2.new(0, 0, 0, 510) | |
121 | closebtn.Position = UDim2.new(0, 0, 0, 510) | |
122 | openguibtn.Position = UDim2.new(0, 0, 0, 590) | |
123 | playmusicbtn.Position = UDim2.new(0, 50, 0, 200) | |
124 | stopmusicbtn.Position = UDim2.new(0, 175, 0, 197) | |
125 | musicidbox.Position = UDim2.new(0, 0, 0, 100) | |
126 | credit.Position = UDim2.new(0, 0, 0, 470) | |
127 | title.Position = UDim2.new(0, 0, 0, 0) | |
128 | playmusicint.Position = UDim2.new(0, 200, 0, 100) | |
129 | ||
130 | -- SET TEXT -- | |
131 | ||
132 | title.Text = "GPlayr (BETA)" | |
133 | credit.Text = "GPlayr & radio scripting by Developer / ModernLukest" | |
134 | musicidbox.Text = "Enter Sound ID Here" | |
135 | openbtn.Text = "Take Out Radio" | |
136 | closebtn.Text = "Put Away Radio" | |
137 | openguibtn.Text = "Open/Close Music GUI" | |
138 | ||
139 | -- SET IMAGE IDS -- | |
140 | playmusicbtn.Image = "rbxassetid://499381047" | |
141 | stopmusicbtn.Image = "rbxassetid://499381006" | |
142 | ||
143 | -- BACKGROUND COLOR3 -- | |
144 | ||
145 | playmusicint.BackgroundColor3 = Color3.new(136, 136, 136) | |
146 | openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
147 | closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
148 | openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
149 | musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109) | |
150 | ||
151 | -- BACKGROUND TRANSPARENCY -- | |
152 | ||
153 | playmusicint.BackgroundTransparency = 0.9 | |
154 | playmusicbtn.BackgroundTransparency = 1 | |
155 | stopmusicbtn.BackgroundTransparency = 1 | |
156 | musicidbox.BackgroundTransparency = 0.43 | |
157 | credit.BackgroundTransparency = 1 | |
158 | title.BackgroundTransparency = 1 | |
159 | ||
160 | -- BORDER SIZE PIXEL -- | |
161 | ||
162 | musicidbox.BorderSizePixel = 0 | |
163 | openbtn.BorderSizePixel = 3 | |
164 | closebtn.BorderSizePixel = 3 | |
165 | openguibtn.BorderSizePixel = 3 | |
166 | ||
167 | -- FONTS -- | |
168 | musicidbox.Font = "SourceSansLight" | |
169 | credit.Font = "SourceSansLight" | |
170 | title.Font = "SourceSansLight" | |
171 | ||
172 | ||
173 | -- TEXT SCALED -- | |
174 | credit.TextScaled = true | |
175 | title.TextScaled = true | |
176 | ||
177 | -- TEXT WRAPPED -- | |
178 | musicidbox.TextWrapped = true | |
179 | credit.TextWrapped = true | |
180 | title.TextWrapped = true | |
181 | openguibtn.TextWrapped = true | |
182 | ||
183 | -- FONT SIZE -- | |
184 | musicidbox.FontSize = "Size28" | |
185 | ||
186 | -- ACTIVE -- | |
187 | playmusicint.Active = true | |
188 | ||
189 | -- DRAGGABLE -- | |
190 | playmusicint.Draggable = true | |
191 | ||
192 | -- GUI FUNCTIONS (MAIN) -- | |
193 | ||
194 | -- set up the stuff -- | |
195 | isGuiOpen = false | |
196 | closebtn.Visible = false | |
197 | playmusicint.Visible = false | |
198 | openguibtn.Visible = false | |
199 | ||
200 | openbtn.MouseButton1Click:connect(function() | |
201 | openbtn.Visible = false | |
202 | closebtn.Visible = true | |
203 | ||
204 | local radio = Instance.new("Part", char) | |
205 | radio.Name = "Radio" | |
206 | local mesh = Instance.new("FileMesh", radio) | |
207 | mesh.MeshId = "http://www.roblox.com/asset/?id=212302951" | |
208 | mesh.TextureId = "http://www.roblox.com/asset/?id=212303049" | |
209 | mesh.Scale = Vector3.new(4, 4, 4) | |
210 | mesh.VertexColor = Vector3.new(1, 1, 1) | |
211 | mesh.Offset = Vector3.new(0, 0, 0) | |
212 | ||
213 | ||
214 | local function weldBetween(a, b) | |
215 | local weld = Instance.new("ManualWeld") | |
216 | weld.Part0 = a | |
217 | weld.Part1 = b | |
218 | weld.C0 = CFrame.new() | |
219 | weld.C1 = b.CFrame:inverse() * a.CFrame | |
220 | weld.Parent = a | |
221 | return weld; | |
222 | end | |
223 | local hand = radio:clone() | |
224 | hand.Parent=char | |
225 | hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45)) | |
226 | weldBetween(char:WaitForChild("Torso"), hand) | |
227 | hand.CanCollide=true | |
228 | hand.Anchored=false | |
229 | ||
230 | sound = Instance.new("Sound", hand) -- we will now call the radio "hand" | |
231 | sound.Volume = 0.5 | |
232 | sound.Pitch = 1 | |
233 | ||
234 | openguibtn.Visible = true | |
235 | char:FindFirstChild("Radio"):Destroy() | |
236 | end) | |
237 | ||
238 | ||
239 | closebtn.MouseButton1Click:connect(function() | |
240 | openbtn.Visible = true | |
241 | closebtn.Visible = false | |
242 | openguibtn.Visible = false | |
243 | playmusicint.Visible = false | |
244 | isGuiOpen = false | |
245 | char:WaitForChild("Radio"):Destroy() | |
246 | end) | |
247 | ||
248 | playmusicbtn.MouseButton1Click:connect(function() | |
249 | sound:stop() | |
250 | wait(0.2) | |
251 | sound.SoundId = "rbxassetid://"..musicidbox.Text | |
252 | sound:play() | |
253 | end) | |
254 | ||
255 | stopmusicbtn.MouseButton1Click:connect(function() | |
256 | sound:stop() | |
257 | end) | |
258 | ||
259 | ||
260 | openguibtn.MouseButton1Click:connect(function() | |
261 | if isGuiOpen == false then isGuiOpen = true | |
262 | playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false | |
263 | end | |
264 | end) |