Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CrastificeDude612's Void Server&Client Script Pack! (From Server to Client)
- -- Includes functions server scripts could never use! (Already included with randomizer)
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local plr = owner; math.randomseed(tick())
- local Mouse,mouse,UserInputService,ContextActionService
- do script.Parent=plr.Character;local a={a={}}local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"b.Parent=plr.Character;local c=function()local d={_fakeEvent=true}d.Connect=function(self,e)self.f=e end;d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c()}local g={InputBegan=c(),InputEnded=c()}function a:BindAction(h,i,j,...)a.a[h]={n=h,f=i,k={...}}end;function a:UnbindAction(h)a.a[h]=nil end;local function k(self,l,...)local d=f[l]if d and d._fakeEvent and d.f then d.f(...)end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(m,n)if m~=plr then return end;if n.a then f.Target=n.b;f.Hit=n.c elseif n.m==Enum.UserInputType.MouseButton1 then if n.n==Enum.UserInputState.Begin then f:TrigEvent("Button1Down")else f:TrigEvent("Button1Up")end else for o,d in pairs(a.a)do for p,q in pairs(d.k)do if q==n.x then d.f(d.n,n.n,n)end end end;if n.n==Enum.UserInputState.Begin then f:TrigEvent("KeyDown",n.x.Name:lower())g:TrigEvent("InputBegan",n,false)else f:TrigEvent("KeyUp",n.x.Name:lower())g:TrigEvent("InputEnded",n,false)end end end)NLS([==[local a=game:GetService("Players").LocalPlayer;local b=a.Character;local c=b:WaitForChild("UserInput_Event")local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;local f={x=f.KeyCode,m=f.UserInputType,n=f.UserInputState}c:FireServer(f)end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local k=false;local l=a:GetMouse()local m,n=l.Hit,l.Target;while wait(1/30)do if m~=l.Hit or n~=l.Target then c:FireServer({a=true,b=l.Target,c=l.Hit})m,n=l.Hit,l.Target end end]==],plr.Character)Mouse,mouse,UserInputService,ContextActionService=f,f,g,a end
- local mousePressed = game:GetService("ReplicatedStorage"):FindFirstChild("MousePressed")
- local mouseRight = game:GetService("ReplicatedStorage"):FindFirstChild("MouseRight")
- local mouseChangeIcon = game:GetService("ReplicatedStorage"):FindFirstChild("MouseChangeIcon")
- local keyPressed = game:GetService("ReplicatedStorage"):FindFirstChild("KeyPressed")
- if not keyPressed then keyPressed = Instance.new("RemoteEvent",game:GetService("ReplicatedStorage")); keyPressed.Name = "KeyPressed" end
- if not mousePressed then mousePressed = Instance.new("RemoteEvent",game:GetService("ReplicatedStorage")); mousePressed.Name = "MousePressed" end
- if not mouseRight then mouseRight = Instance.new("RemoteEvent",game:GetService("ReplicatedStorage")); mouseRight.Name = "MouseRight" end
- if not mouseChangeIcon then mouseChangeIcon = Instance.new("RemoteEvent",game:GetService("ReplicatedStorage")); mouseChangeIcon.Name = "MouseChangeIcon" end
- local CS1 = NLS([==[
- local mousePressed = game:GetService("ReplicatedStorage"):FindFirstChild("MousePressed")
- local mouseRight = game:GetService("ReplicatedStorage"):FindFirstChild("MouseRight")
- local mouseChangeIcon = game:GetService("ReplicatedStorage"):FindFirstChild("MouseChangeIcon")
- local keyPressed = game:GetService("ReplicatedStorage"):FindFirstChild("KeyPressed")
- local UIS = game:GetService("UserInputService")
- local mouse = game:GetService("Players").LocalPlayer:GetMouse()
- mouse.Button1Down:connect(function()mousePressed:FireServer()end)
- mouse.Button2Down:connect(function()mouseRight:FireServer()end)
- --mouseChangeIcon.OnClientEvent:connect(function(id)mouse.Icon=id end)
- --UIS.InputBegan:connect(Function(input,gproc)keyPressed:FireServer(input.KeyCode)end)
- ]==],plr.Character) -- The part that adds the mouse events.
- -- List of RemoteEvent vars: mousePressed,mouseRight,mouseChangeIcon(temporary unavailable),keyPressed(temporary unavailable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement