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