Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local module={}
- local localscript = script.LocalScript:Clone()
- script.LocalScript:Destroy()
- self={}
- function module:GetMouse(player)
- if game:GetService("RunService"):IsServer() then
- if not self["Player"] then
- local mouse = {}
- self["Player"] = player
- script.Parent = self["Player"].PlayerGui
- localscript:Clone().Parent = script
- local KeyDownRemote = Instance.new("RemoteEvent",script)
- local KeyUpRemote = Instance.new("RemoteEvent",script)
- local Button1DownRemote = Instance.new("RemoteEvent",script)
- local Button1UpRemote = Instance.new("RemoteEvent",script)
- local MoveRemote = Instance.new("RemoteEvent",script)
- local HitRemote = Instance.new("RemoteEvent",script)
- local TargetRemote = Instance.new("RemoteEvent",script)
- local KeyDownEvent = Instance.new("BindableEvent")
- local KeyUpEvent = Instance.new("BindableEvent")
- local Button1DownEvent = Instance.new("BindableEvent")
- local Button1UpEvent = Instance.new("BindableEvent")
- local MoveEvent = Instance.new("BindableEvent")
- mouse.KeyDown = KeyDownEvent.Event
- mouse.KeyUp = KeyUpEvent.Event
- mouse.Button1Down = Button1DownEvent.Event
- mouse.Button1Up = Button1UpEvent.Event
- mouse.Move = MoveEvent.Event
- mouse.Target = nil
- mouse.Hit = CFrame.new(0,0,0) *CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
- KeyDownRemote.OnServerEvent:Connect(function(p,k)if p == self["Player"] and k then KeyDownEvent:Fire(k) end end)
- KeyUpRemote.OnServerEvent:Connect(function(p,k)if p == self["Player"] and k then KeyUpEvent:Fire(k)end end)
- Button1DownRemote.OnServerEvent:Connect(function(p)if p == self["Player"] then Button1DownEvent:Fire()end end)
- Button1UpRemote.OnServerEvent:Connect(function(p)if p == self["Player"] then Button1UpEvent:Fire()end end)
- TargetRemote.OnServerEvent:Connect(function(p,t)if p == self["Player"] then mouse.Target=t end end)
- HitRemote.OnServerEvent:Connect(function(p,h)if p == self["Player"]then mouse.Hit = h end end)
- KeyDownRemote.Name = "KeyDown"
- KeyUpRemote.Name = "KeyUp"
- Button1DownRemote.Name = "Button1Down"
- Button1UpRemote.Name = "Button1Up"
- MoveRemote.Name = "Move"
- HitRemote.Name = "Hit"
- TargetRemote.Name = "Target"
- return mouse
- end
- else
- error("THIS IS SERVER SIDE SCRIPT")
- end
- end
- return module
Add Comment
Please, Sign In to add comment