Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- do
- print("FE Compatibility code by Mokiros")
- script.Parent = Player.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,Connect=function(self,f)self.Function=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 and t.Function then
- t.Function(...)
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=Player then return end
- if io.isMouse then
- m.Target = io.Target
- m.Hit = io.Hit
- else
- 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 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})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local Mouse = Player:GetMouse()
- 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)
- Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
- end
- local plr = owner
- repeat wait() until plr.Character
- local char = plr.Character
- local baldgui =Instance.new("BillboardGui")
- baldgui.Parent = char.Head
- baldgui.Adornee = char.Head
- baldgui.Size=UDim2.new(3.5,0,8.5,0)
- baldgui.StudsOffset=Vector3.new(0,0.2,0)
- local boosted = false
- local playing = false
- local doors = {nil}
- local doormag = {nil}
- local dooropeneds = {nil}
- local doorwaits = {nil}
- local doorsound = Instance.new("Sound",nil)
- local doorosunds = {"rbxassetid://1874737540","rbxassetid://1874737174"}
- local doorsprites = {"http://www.roblox.com/asset/?id=1804020342","http://www.roblox.com/asset/?id=1804457660"}
- local SlapSound = Instance.new("Sound",char.Torso)
- local doorsoundplays = {nil}
- local hnsm = Instance.new("Sound",char.Torso)
- SlapSound.Volume = 10
- hnsm.Volume = 10
- local image =Instance.new("ImageLabel")
- image.Image = "http://www.roblox.com/asset/?id=4283303552"
- local slapimages = {"http://www.roblox.com/asset/?id=4283300825","http://www.roblox.com/asset/?id=4283301491","http://www.roblox.com/asset/?id=4283302321","http://www.roblox.com/asset/?id=4283302955","http://www.roblox.com/asset/?id=4283303552"}
- image.Size=UDim2.new(1,0,1,0)
- image.Position=UDim2.new(0,0,0,0)
- image.BackgroundTransparency = 1
- image.Parent=baldgui
- local rs = game:GetService("RunService").Stepped
- repeat wait() until char:FindFirstChildOfClass("Accessory")
- char.Humanoid.Animator:Destroy()
- rs:Connect(function()
- if #doormag > -1 then
- for i = 0,#dooropeneds do
- doormag[i] = (doors[i].Position - char.Torso.Position).magnitude
- doorwaits[i] = doorwaits[i] - 0.025
- if doormag[i] < 6 then
- doorwaits[i] = 3
- dooropeneds[i] = true
- SetDecalTexture(doorsprites[2],doors[i].f)
- SetDecalTexture(doorsprites[2],doors[i].b)
- setCollid(doors[i],false)
- setTrans(doors[i],1)
- if doorsoundplays[i] == 0 then
- setSoundID(doors[i].Sound,doorosunds[2])
- doors[i].Sound:Play()
- doorsoundplays[i] = 1
- end
- else
- if doorwaits[i] < 0.1 then
- dooropeneds[i] = false
- SetDecalTexture(doorsprites[1],doors[i].f)
- SetDecalTexture(doorsprites[1],doors[i].b)
- setCollid(doors[i],true)
- setTrans(doors[i],0)
- if doorsoundplays[i] == 1 then
- setSoundID(doors[i].Sound,doorosunds[1])
- doors[i].Sound:Play()
- doorsoundplays[i] = 0
- end
- end
- end
- end
- end
- end)
- local talkimages = {"http://www.roblox.com/asset/?id=4392260496","http://www.roblox.com/asset/?id=4392261038","http://www.roblox.com/asset/?id=4392260496","http://www.roblox.com/asset/?id=4283303552"}
- for i,v in pairs(char:GetChildren()) do
- if v.ClassName == "Part" or v.ClassName == "Union" or v.ClassName == "MeshPart" then
- v.Transparency = 1
- end
- if v.ClassName == "Accessory" then
- v.Handle.Transparency = 1
- end
- end
- function setSoundID(sound,id)
- sound.SoundId = id
- end
- function setPlrWalkSpeed(speed)
- char.Humanoid.WalkSpeed = speed
- end
- function setTrans(part,trans)
- part.Transparency = trans
- end
- function setCollid(part,col)
- part.CanCollide = col
- end
- setPlrWalkSpeed(0)
- setSoundID(SlapSound,"rbxassetid://1804495872")
- setSoundID(hnsm,"rbxassetid://399712419")
- SlapSound.TimePosition = 0.1
- char.Head.face.Transparency = 1
- function Slap()
- SlapSound:Play()
- if boosted == false then
- setPlrWalkSpeed(60)
- boosted = true
- end
- image.Image = slapimages[1]
- wait(0.3)
- if boosted == true then
- setPlrWalkSpeed(0)
- end
- boosted = false
- if playing == false then
- playing = true
- for i=2,#slapimages do
- wait(0.05)
- image.Image = slapimages[i]
- end
- playing = false
- end
- end
- function SetDecalTexture(texture,decal)
- decal.Texture = texture
- end
- function SDS(decal,side)
- decal.Face = side
- end
- function milk()
- hnsm:Play()
- local tim = 0
- for i = 0,20 do
- wait(0.05)
- tim=tim+1
- if tim > #talkimages then
- tim = 1
- end
- image.Image = talkimages[tim]
- end
- image.Image = talkimages[#talkimages]
- baldgui.Size=UDim2.new(3.5,0,8.5,0)
- image.Rotation = 0
- end
- mouse.Button1Down:connect(function()
- Slap()
- end)
- mouse.KeyDown:connect(function(k)
- if k == "m" then
- milk()
- end
- if k == "n" then
- image.Image = "http://www.roblox.com/asset/?id=4392323375"
- setPlrWalkSpeed(60)
- end
- if k == "e" then
- local door = Instance.new("Part",char)
- table.insert(doors,0,door)
- table.insert(dooropeneds,0,false)
- table.insert(doorsoundplays,0,0)
- table.insert(doormag,0,0)
- table.insert(doorwaits,0,0)
- local sound = Instance.new("Sound",door)
- sound.Volume = 3
- door.Size = Vector3.new(6, 12, 0.05)
- door.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,2.5,-9)
- local front = Instance.new("Decal",door)
- front.Name = "f"
- local back = Instance.new("Decal",door)
- back.Name = "b"
- SetDecalTexture(doorsprites[1],front)
- SetDecalTexture(doorsprites[1],back)
- SDS(front,"Front")
- SDS(front,"Back")
- door.Anchored = true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement