--just put this on the top of a script and boom 89% works --note this does not work on big scripts if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end local Player,game,owner = owner,game local RealPlayer = Player do local rp = RealPlayer script.Parent = rp.Character --RemoteEvent for communicating local Event = Instance.new("RemoteEvent") Event.Name = "UserInput_Event" --Fake event to make stuff like Mouse.KeyDown work local function fakeEvent() local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end} t.connect = t.Connect return t end --Creating fake input objects with fake variables local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil end} --Merged 2 functions into one by checking amount of arguments CAS.UnbindAction = CAS.BindAction --This function will trigger the events that have been :Connect()'ed local function te(self,ev,...) local t = m[ev] if t and t._fakeEvent then for _,f in pairs(t.Functions) do f(...) end end end m.TrigEvent = te UIS.TrigEvent = te Event.OnServerEvent:Connect(function(plr,io) if plr~=rp then return end m.Target = io.Target m.Hit = io.Hit if not io.isMouse then local b = io.UserInputState == Enum.UserInputState.Begin if io.UserInputType == Enum.UserInputType.MouseButton1 then return m:TrigEvent(b and "Button1Down" or "Button1Up") end for _,t in pairs(CAS.Actions) do for _,k in pairs(t.Keys) do if k==io.KeyCode then t.Function(t.Name,io.UserInputState,io) end end end m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) end end) Event.Parent = NLS([==[ local Player = game:GetService("Players").LocalPlayer local Event = script:WaitForChild("UserInput_Event") local Mouse = Player:GetMouse() local UIS = game:GetService("UserInputService") local input = function(io,a) if a then return end --Since InputObject is a client-side instance, we create and pass table instead Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) end UIS.InputBegan:Connect(input) UIS.InputEnded:Connect(input) local h,t --Give the server mouse data 30 times every second, but only if the values changed --If player is not moving their mouse, client won't fire events while wait(1/30) do if h~=Mouse.Hit or t~=Mouse.Target then h,t=Mouse.Hit,Mouse.Target Event:FireServer({isMouse=true,Target=t,Hit=h}) end end]==],Player.Character) ----Sandboxed game object that allows the usage of client-side methods and services --Real game object local _rg = game --Metatable for fake service local fsmt = { __index = function(self,k) local s = rawget(self,"_RealService") if s then return s[k] end end, __newindex = function(self,k,v) local s = rawget(self,"_RealService") if s then s[k]=v end end, __call = function(self,...) local s = rawget(self,"_RealService") if s then return s(...) end end } local function FakeService(t,RealService) t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService return setmetatable(t,fsmt) end --Fake game object local g = { GetService = function(self,s) return self[s] end, Players = FakeService({ LocalPlayer = FakeService({GetMouse=function(self)return m end},Player) },"Players"), UserInputService = FakeService(UIS,"UserInputService"), ContextActionService = FakeService(CAS,"ContextActionService"), } rawset(g.Players,"localPlayer",g.Players.LocalPlayer) g.service = g.GetService g.RunService = FakeService({ RenderStepped = _rg:GetService("RunService").Heartbeat, BindToRenderStep = function(self,name,_,fun) self._btrs[name] = self.Heartbeat:Connect(fun) end, UnbindFromRenderStep = function(self,name) self._btrs[name]:Disconnect() end, },"RunService") setmetatable(g,{ __index=function(self,s) return _rg:GetService(s) or typeof(_rg[s])=="function" and function(_,...)return _rg[s](_rg,...)end or _rg[s] end, __newindex = fsmt.__newindex, __call = fsmt.__call }) --Changing owner to fake player object to support owner:GetMouse() game,owner = g,g.Players.LocalPlayer end wait(1) local debris = game:GetService("Debris") local playerservice = game:GetService("Players") local xplayer = playerservice.LocalPlayer repeat wait(.5) until xplayer ~= nil local xcharacter = xplayer.Character local playermouse = xplayer:GetMouse() local playercam = workspace.CurrentCamera local playercharacter = xplayer.Character repeat wait(.5) until xplayer.Character ~=nil local xhumanoid = xcharacter:WaitForChild('Humanoid') local rltool = Instance.new("Tool") rltool.Name = 'GuidedMissile' rltool.GripForward = Vector3.new(0,0,-1) rltool.GripPos = Vector3.new(0.05,-0.6,-1) rltool.GripRight = Vector3.new(1,0,0) rltool.GripUp = Vector3.new(0,1,0) rltool.ToolTip = 'Launch the rocket and you will begin controlling the rocket' local handle = Instance.new("Part",rltool) handle.Name = "Handle" handle.Material = 'Plastic' handle.CanCollide = true handle.Locked = true handle.Size = Vector3.new(0.84,1.15,3.55) handle.TopSurface = 'Smooth' handle.BottomSurface = 'Smooth' local handlemesh = Instance.new("SpecialMesh",handle) handlemesh.MeshType = Enum.MeshType.FileMesh handlemesh.MeshId = "http://www.roblox.com/asset/?id=94690054" handlemesh.TextureId = "http://www.roblox.com/asset/?id=94689966" handlemesh.Scale = Vector3.new(1.5,1.5,1.5) local MainTool = rltool local AmmoSize = 1 local CurrentAmmo = 1 local AmmoMax = math.huge local ToolEnabled = true local GuidedRocket = false local camerafollow = xhumanoid BaseRocket = nil local cooldown = 4 local RocketSpeed = 75 local newsound = Instance.new("Sound") newsound.Name = 'NewSound' newsound.Volume = 1 newsound.PlaybackSpeed = 1 newsound.EmitterSize = 10 newsound.MaxDistance = 10000 newsound.Looped = false MainTool.Parent = xplayer.Backpack local RocketSize = Vector3.new(1,1,4) function CreateBaseRocket() local rocket = Instance.new("Part") rocket.Name = "Rocket" rocket.Size = RocketSize rocket.CanCollide = false rocket.BottomSurface = 'Smooth' rocket.TopSurface = 'Smooth' rocket.BrickColor = BrickColor.Random() local specialmesh = Instance.new("SpecialMesh",rocket) specialmesh.MeshType = Enum.MeshType.FileMesh specialmesh.Scale = Vector3.new(.5,.5,.2) specialmesh.MeshId = "http://www.roblox.com/asset/?id=2251534" local attachmentr1 = Instance.new("Attachment",rocket) attachmentr1.Name = 'R0' attachmentr1.Position = Vector3.new(-1,0,-1) local attachmentr2 = attachmentr1:Clone() attachmentr2.Name = 'R1' attachmentr2.Position = Vector3.new(1,0,1) attachmentr2.Parent = rocket local trail = Instance.new("Trail",rocket) trail.LightEmission = .75 trail.Color = ColorSequence.new(Color3.new(255/255,0,0),Color3.new(255/255,120/255,0)) trail.Attachment0 = attachmentr1 trail.Attachment1 = attachmentr2 trail.MaxLength = 15 trail.MinLength = .1 trail.Lifetime = 4.5 trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0,0.0); NumberSequenceKeypoint.new(.858,.081); NumberSequenceKeypoint.new(.958,.181); NumberSequenceKeypoint.new(1,1.0); }) --[[local bodyForce = Instance.new('BodyForce', rocket) bodyForce.Name = 'Antigravity' bodyForce.force = Vector3.new(0, rocket:GetMass() * workspace.Gravity, 0)]] BaseRocket = rocket end function ToolEquipped() CreateBaseRocket() if GuidedRocket == true then MainTool.Enabled = false end if GuidedRocket == false then MainTool.Enabled = true end end --[[function ControlRocket(main,Control_OBJ,Target_Position) Control_OBJ.TargetOffset = Target_Position end]] function ToolActivated() if ToolEnabled== true and xcharacter and xhumanoid.Health > 0 then local targetPosition = xhumanoid.TargetPoint ToolEnabled = false local SwooshSound = newsound:Clone() SwooshSound.PlaybackSpeed = .5 SwooshSound.SoundId = "http://www.roblox.com/Asset?ID=132456187" SwooshSound.Name = 'Swoosh' SwooshSound.Volume = 1 SwooshSound.Looped = true local BoomSound = newsound:Clone() BoomSound.PlaybackSpeed = .7 BoomSound.Volume = 3 BoomSound.PlayOnRemove = true BoomSound.SoundId = "http://www.roblox.com/Asset?ID=138186576" BoomSound.Name = 'Boom' BoomSound.Looped = false local GRocket = BaseRocket:Clone() local RocketControl = Instance.new("RocketPropulsion",GRocket) RocketControl.CartoonFactor = 1 RocketControl.MaxSpeed = RocketSpeed RocketControl.TargetOffset = targetPosition RocketControl.ThrustD = 50000 RocketControl.ThrustP = 500 RocketControl.TargetRadius = 5 RocketControl.MaxThrust = 50000 RocketControl.MaxTorque = Vector3.new(4e6, 4e6, 0) local spawnPosition = (handle.CFrame * CFrame.new(0, 0, -4)).p GRocket.CFrame = CFrame.new(spawnPosition, targetPosition) GRocket.Velocity = GRocket.CFrame.lookVector * RocketSpeed SwooshSound.Parent = GRocket BoomSound.Parent = GRocket debris:AddItem(GRocket,20) GRocket.Parent = workspace playercam.CameraSubject = GRocket RocketControl:Fire() SwooshSound.Playing = false wait(.15) wait(.15) SwooshSound:Play() GRocket.Touched:connect(function(part) if part and GRocket then if part.Parent then if part.Parent and part.Parent.Name ~= xcharacter.Name then local Explosion = Instance.new("Explosion",workspace) Explosion.Position = GRocket.Position Explosion.BlastPressure = 100000 Explosion.BlastRadius = 14 Explosion.ExplosionType = Enum.ExplosionType.CratersAndDebris GuidedRocket = false playercam.CameraSubject = xhumanoid GRocket:Destroy() end end end end) GuidedRocket = true playermouse.Move:Connect(function() if GuidedRocket == true then playermouse.TargetFilter = GRocket RocketControl.TargetOffset = Vector3.new(playermouse.Hit.X,playermouse.Hit.Y,playermouse.Hit.Z) end end) if GRocket.Parent ~= nil and GuidedRocket==true then print('Controlling the rocket') end repeat wait(1) until GRocket.Parent == nil GuidedRocket = false playermouse.TargetFilter = nil playercam.CameraSubject = xhumanoid GuidedRocket = false wait(3) GuidedRocket = false ToolEnabled = true end end function PlayerDied() if GuidedRocket == true and playercam.CameraSubject ~= xhumanoid then GuidedRocket = false playercam.CameraSubject = xhumanoid ToolEnabled = false MainTool.Enabled = false end if playercam.CameraSubject ~= xhumanoid then ToolEnabled = false MainTool.Enabled = false playercam.CameraSubject = xhumanoid GuidedRocket = false end end function ToolUnequipped() MainTool.Enabled = false end MainTool.Equipped:Connect(ToolEquipped) MainTool.Unequipped:Connect(ToolUnequipped) MainTool.Activated:Connect(ToolActivated) xhumanoid.Died:Connect(PlayerDied)