local owner = game:GetService("Players").jimmyswaggyo
local function hn(c, ...)
local thd = task.spawn(hn, c, ...)
if coroutine.status(thd) == "dead" then
task.cancel(thd)
return
end
return c(...)
end
local chr = owner.Character
local hum = chr:FindFirstChildWhichIsA("Humanoid")
chr.Parent = game:GetService("ReplicatedStorage")
script.Name = "fakeChrModel" .. owner.Name
local fakeChr
local root, torso, head, la, ra, ll, rl, blaster, sword, le, re
local rj, nk, ls, rs, lh, rh
local rjc0, nkc0, lsc0, rsc0, lhc0, rhc0
local fTorX1, fTorX2, bTorX1, bTorX2, sTorL1, sTorL2, sLLegL1, sLLegL2, fLLegL1, fLLegL2, bLLegL1, bLLegL2, sRLegL1, sRLegL2, fRLegL1, fRLegL2, bRLegL1, bRLegL2
local refit = false
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.IgnoreWater = true
raycastParams.RespectCanCollide = true
raycastParams.FilterDescendantsInstances = {script}
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Exclude
overlapParams.RespectCanCollide = true
overlapParams.FilterDescendantsInstances = {script}
local sounds = {
["deathSound"] = {
}
}
local function createPart(n, s, m, c, t, p)
local limb = Instance.new("Part")
limb.Name = n
limb.Size = s
limb.Material = m
limb.Color = c
limb.Transparency = t
limb.Parent = p
limb.CanCollide = false
limb.CanQuery = false
limb.Anchored = true
limb.Locked = true
return limb
end
local function IsInWater(pos)
local region = Region3.new(pos - Vector3.one*4, pos + Vector3.one*4)
return workspace.Terrain:ReadVoxels(region, 4)[1][1][1] == Enum.Material.Water
end
local weld = {}
weld.__index = weld
function weld.new(p0, p1, c0, c1)
local self = setmetatable({}, weld)
self.part0 = p0
self.part1 = p1
self.c0 = c0
self.c1 = c1
return self
end
function weld:Enforce()
self.part1.CFrame = self.part0.CFrame * self.c0 * self.c1:Inverse()
end
local previousCF = chr.HumanoidRootPart.Position
local function createChr()
fakeChr = Instance.new("Model")
fakeChr.Name = "fakeChr" .. owner.Name
fakeChr.Parent = script
root = createPart("r", Vector3.new(2, 2, 1), Enum.Material.DiamondPlate, Color3.new(), 1, fakeChr)
root.Position = previousCF
cam = createPart("c", Vector3.new(1, 1, 1), Enum.Material.DiamondPlate, Color3.new(), 1, script)
head = createPart("h", Vector3.new(1, 1, 1), Enum.Material.Metal, Color3.fromRGB(163, 162, 165), 0, fakeChr)
torso = createPart("t", Vector3.new(2, 2, 1), Enum.Material.Metal, Color3.new(1, 0, 0), 0, fakeChr)
fTorX1 = createPart("fTX1", Vector3.new(0.1, 2, 0.01), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
fTorX2 = createPart("fTX2", Vector3.new(0.1, 2, 0.01), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
bTorX1 = createPart("bTX1", Vector3.new(0.1, 2, 0.01), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
bTorX2 = createPart("bTX2", Vector3.new(0.1, 2, 0.01), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
sTorL1 = createPart("sTL1", Vector3.new(0.01, 0.6, 0.1), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
sTorL2 = createPart("sTL2", Vector3.new(0.01, 0.6, 0.1), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
sLLegL1 = createPart("sLLL1", Vector3.new(0.01, 0.6, 0.1), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
sLLegL2 = createPart("sLLL2", Vector3.new(0.01, 0.6, 0.1), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
fLLegL1 = createPart("fLLL1", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
fLLegL2 = createPart("fLLL2", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
bLLegL1 = createPart("bLLL1", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
bLLegL2 = createPart("bLLL2", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
sRLegL1 = createPart("sRLL1", Vector3.new(0.01, 0.6, 0.1), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
sRLegL2 = createPart("sRLL2", Vector3.new(0.01, 0.6, 0.1), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
fRLegL1 = createPart("fRLL1", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
fRLegL2 = createPart("fRLL2", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
bRLegL1 = createPart("bRLL1", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
bRLegL2 = createPart("bRLL2", Vector3.new(0.1, 0.6, 0.01), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
la = createPart("la", Vector3.new(1, 2, 1), Enum.Material.Metal, Color3.fromRGB(163, 162, 165), 0, fakeChr)
ra = createPart("ra", Vector3.new(1, 2, 1), Enum.Material.Metal, Color3.fromRGB(163, 162, 165), 0, fakeChr)
ll = createPart("ll", Vector3.new(1, 2, 1), Enum.Material.Metal, Color3.fromRGB(33, 84, 185), 0, fakeChr)
rl = createPart("rl", Vector3.new(1, 2, 1), Enum.Material.Metal, Color3.fromRGB(33, 84, 185), 0, fakeChr)
blaster = createPart("b", Vector3.new(1, 1, 3), Enum.Material.Neon, Color3.fromRGB(82, 124, 174), 0, fakeChr)
sword = createPart("s", Vector3.new(0.2, 4, 1), Enum.Material.Neon, Color3.fromRGB(255, 89, 89), 0, fakeChr)
le = createPart("le", Vector3.new(0.125, 0.375, 0.05), Enum.Material.Neon, Color3.new(), 1, fakeChr)
re = createPart("re", Vector3.new(0.125, 0.375, 0.05), Enum.Material.Neon, Color3.new(), 1, fakeChr)
local leTexture = Instance.new("Decal")
leTexture.Texture = "rbxasset://textures/CollisionGroupsEditor/unchecked.png"
leTexture.Color3 = Color3.new(0, 0, 0)
leTexture.Parent = le
local reTexture = Instance.new("Decal")
reTexture.Texture = "rbxasset://textures/CollisionGroupsEditor/unchecked.png"
reTexture.Color3 = Color3.new(0, 0, 0)
reTexture.Parent = re
nk = weld.new(torso, head, CFrame.new(0, 1, 0), CFrame.new(0, -0.5, 0))
rj = weld.new(root, torso, CFrame.new(0, 0, 0), CFrame.new(0, 0, 0))
ls = weld.new(torso, la, CFrame.new(-1.5, 0.5, 0), CFrame.new(0, 0.5, 0))
rs = weld.new(torso, ra, CFrame.new(1.5, 0.5, 0), CFrame.new(0, 0.5, 0))
lh = weld.new(torso, ll, CFrame.new(-0.5, -1, 0), CFrame.new(0, 1, 0))
rh = weld.new(torso, rl, CFrame.new(0.5, -1, 0), CFrame.new(0, 1, 0))
nkc0 = nk.c0
rjc0 = rj.c0
lsc0 = ls.c0
rsc0 = rs.c0
lhc0 = lh.c0
rhc0 = rh.c0
local connTable = {}
for _, p in pairs(script:GetDescendants()) do
if p:IsA("BasePart") then
local conn; conn = p:GetPropertyChangedSignal("Parent"):Connect(function(parent)
if parent == nil then
refit = true
print('refitted')
for _, c in pairs(connTable) do
c:Disconnect()
end
end
end)
table.insert(connTable, conn)
end
end
end
createChr()
local function enforceChr()
rj:Enforce()
nk:Enforce()
ls:Enforce()
rs:Enforce()
lh:Enforce()
rh:Enforce()
fTorX1.CFrame = torso.CFrame * CFrame.new(0, 0, -0.51) * CFrame.Angles(0, 0, math.rad(45))
fTorX2.CFrame = torso.CFrame * CFrame.new(0, 0, -0.51) * CFrame.Angles(0, 0, -math.rad(45))
bTorX1.CFrame = torso.CFrame * CFrame.new(0, 0, 0.51) * CFrame.Angles(0, 0, math.rad(45))
bTorX2.CFrame = torso.CFrame * CFrame.new(0, 0, 0.51) * CFrame.Angles(0, 0, -math.rad(45))
sTorL1.CFrame = torso.CFrame * CFrame.new(-1.01, -0.5, 0)
sTorL2.CFrame = torso.CFrame * CFrame.new(1.01, -0.5, 0)
sLLegL1.CFrame = ll.CFrame * CFrame.new(-0.51, 0.5, 0)
sLLegL2.CFrame = ll.CFrame * CFrame.new(-0.51, -0.5, 0)
fLLegL1.CFrame = ll.CFrame * CFrame.new(0, 0.5, -0.51)
fLLegL2.CFrame = ll.CFrame * CFrame.new(0, -0.5, -0.51)
bLLegL1.CFrame = ll.CFrame * CFrame.new(0, 0.5, 0.51)
bLLegL2.CFrame = ll.CFrame * CFrame.new(0, -0.5, 0.51)
sRLegL1.CFrame = rl.CFrame * CFrame.new(0.51, 0.5, 0)
sRLegL2.CFrame = rl.CFrame * CFrame.new(0.51, -0.5, 0)
fRLegL1.CFrame = rl.CFrame * CFrame.new(0, 0.5, -0.51)
fRLegL2.CFrame = rl.CFrame * CFrame.new(0, -0.5, -0.51)
bRLegL1.CFrame = rl.CFrame * CFrame.new(0, 0.5, 0.51)
bRLegL2.CFrame = rl.CFrame * CFrame.new(0, -0.5, 0.51)
if currentWeapon == "blaster" and weaponEquip == true then
blaster.CFrame = ra.CFrame * CFrame.new(0, -1.5, -0.5) * CFrame.Angles(-math.rad(90), 0, 0)
sword.CFrame = torso.CFrame * CFrame.new(1.1, -1, 0) * CFrame.Angles(-math.rad(85), 0, 0)
elseif currentWeapon == "sword" and weaponEquip == true then
blaster.CFrame = torso.CFrame * CFrame.new(1, 1.5, 0)
if (os.clock() - lastSwing) < 0.25 then
sword.CFrame = ra.CFrame * CFrame.new(0, -3, 0) * CFrame.Angles(math.rad(180), 0, 0)
else
sword.CFrame = ra.CFrame * CFrame.new(0, -2, -1) * CFrame.Angles(math.rad(55), 0, 0)
end
elseif weaponEquip == false then
blaster.CFrame = torso.CFrame * CFrame.new(1, 1.5, 0)
sword.CFrame = torso.CFrame * CFrame.new(1.1, -1, 0) * CFrame.Angles(-math.rad(85), 0, 0)
end
if math.random(1, 100) == 50 then
task.spawn(function()
blink = true
task.wait(0.1)
blink = false
end)
end
if blink == true then
le.CFrame = head.CFrame * CFrame.new(-0.25, 0.0625, -0.5)
re.CFrame = head.CFrame * CFrame.new(0.25, 0.0625, -0.5)
le.Size = Vector3.new(0.25, 0.125, 0.05)
re.Size = Vector3.new(0.25, 0.125, 0.05)
else
le.CFrame = head.CFrame * CFrame.new(-0.1875, 0.1875, -0.5)
re.CFrame = head.CFrame * CFrame.new(0.1875, 0.1875, -0.5)
le.Size = Vector3.new(0.125, 0.375, 0.05)
re.Size = Vector3.new(0.125, 0.375, 0.05)
end
if root.Anchored == false then
root.Anchored = true
end
if blastCharge == false then
blaster.Material = Enum.Material.Metal
else
blaster.Material = Enum.Material.Neon
end
end
local blastWoosh = Instance.new("Sound")
blastWoosh.SoundId = "rbxassetid://12222095"
blastWoosh.Volume = 1.4
blastWoosh.TimePosition = 0.14
blastWoosh.Pitch = 2
local swoosh = Instance.new("Sound")
swoosh.SoundId = "rbxassetid://12222200"
swoosh.Volume = 1.4
swoosh.Parent = sword
local explode = Instance.new("Sound")
explode.SoundId = "rbxassetid://12221984"
explode.Volume = 2
local blastBullets = {}
local function blast()
local blastBullet = Instance.new("Part")
blastBullet.Size = Vector3.new(0.5, 0.5, 2)
blastBullet.Anchored = true
blastBullet.Color = blaster.Color
blastBullet.Parent = script
blastBullet.CFrame = root.CFrame * CFrame.new(1.5, 1, -2)
blastBullet.Material = blaster.Material
table.insert(blastBullets, blastBullet)
game:GetService("Debris"):AddItem(blastBullet, 15)
local wooshSound = blastWoosh:Clone()
wooshSound.Parent = blastBullet
wooshSound:Play()
game:GetService("Debris"):AddItem(wooshSound, wooshSound.TimeLength / wooshSound.Pitch)
end
local function swing()
local swingHitbox = workspace:GetPartBoundsInBox(sword.CFrame, sword.Size, overlapParams)
for _, p in pairs(swingHitbox) do
if p.Parent:FindFirstChild("Humanoid") then
local hurtHum = p.Parent:FindFirstChild("Humanoid")
hurtHum:TakeDamage(hurtHum.MaxHealth / 4)
end
end
swoosh:Play()
end
local t = 0
local speed = 1
local waterSpeedMult = 0.5
local fallTime = 0
local gravity = 196.2
local translateVector = Vector3.new()
local mouseCF = CFrame.new()
local floor = false
local faceMouse = false
local currentCF = CFrame.new()
local vel = Vector3.new()
local lastShot = os.clock()
local lastSwing = os.clock()
local blink = false
local currentWeapon = ""
local weaponEquip = false
local blastCharge = true
game:GetService("RunService").PostSimulation:Connect(function(dt)
fakeChr:Destroy()
hn(function()
t = t + dt * 60
if script then
if hum.Jump and floor then
fallTime = -0.3
end
previousCF = root.Position
root.Position += translateVector
--local dy = Vector3.yAxis * dt * ((-gravity/2) * dt - gravity)
local dy = Vector3.zero
if hum.MoveDirection.Magnitude > 0.5 then
if not faceMouse then
root.CFrame = CFrame.lookAt(root.Position, root.Position + hum.MoveDirection)
end
translateVector = (hum.MoveDirection / 3) * speed * (IsInWater(root.Position) and waterSpeedMult or 1)
else
translateVector = Vector3.zero
end
local rayBottom = workspace:Blockcast(root.CFrame * CFrame.new(0, -1, 0), Vector3.new(1, 0.25, 0.5), Vector3.yAxis * -2 + dy, raycastParams)
if rayBottom then
local hit, pos = rayBottom.Instance, rayBottom.Position
fallTime = 0
floor = true
root.Position = Vector3.new(root.Position.X, pos.Y + 3, root.Position.Z)
if hit.Velocity.Magnitude > 0 then
root.Position += hit.Velocity / 60
end
else
floor = false
root.Position += dy
end
local rayTop = workspace:Blockcast(root.CFrame, root.Size, root.CFrame.UpVector * -3 + dy, raycastParams)
if rayTop then
fallTime = 0
root.Position += Vector3.new(0, -0.1, 0)
end
fallTime = fallTime + dt
local raySide = workspace:Blockcast(root.CFrame, root.Size, root.CFrame.LookVector.Unit, raycastParams)
if raySide and raySide.Instance.CanCollide then
local hit, pos, norm = raySide.Instance, raySide.Position, raySide.Normal
translateVector -= norm * norm:Dot(translateVector)
end
if faceMouse then
root.CFrame = CFrame.lookAt(root.Position, mouseCF.p * Vector3.new(1, 0, 1))
end
if root.CFrame.Y < -100 then
root.CFrame = CFrame.new(0, 15, 0)
end
vel = root.Position - previousCF
if vel.Y ~= 0 then
speed = math.clamp(speed + 0.01, 1, 3)
rj.c0 = rjc0 * CFrame.Angles(-vel.Y / 10, 0, 0)
nk.c0 = nkc0
ls.c0 = lsc0 * CFrame.Angles(math.rad(120) - vel.Y / 2, -math.rad(5), -math.rad(3))
if weaponEquip == true then
rs.c0 = rsc0 * CFrame.new(0, 0, -0.05) * CFrame.Angles(math.rad(90), 0, 0)
elseif weaponEquip == false then
rs.c0 = rsc0 * CFrame.new(0, 0, 0.15) * CFrame.Angles(-math.rad(65), 0, 0)
end
lh.c0 = lhc0 * CFrame.new(0, vel.Y / 1.5, -0.5 + vel.Y / 3) * CFrame.Angles(math.rad(30) - vel.Y / 3, math.rad(5) - vel.Y / 15, -math.rad(3) + vel.Y / 15)
rh.c0 = rhc0 * CFrame.new(0, vel.Y / 3, 0 - vel.Y / 3) * CFrame.Angles(-math.rad(85) + vel.Y / 5, -math.rad(5) + vel.Y / 15, math.rad(3) - vel.Y / 15)
else
speed = 1
if hum.MoveDirection.Magnitude > 0.5 then
rj.c0 = rjc0 * CFrame.new(0, math.sin(t / 2.5 * speed) / 10, 0) * CFrame.Angles(-math.cos(t / 2.5 * speed) / 40, 0, 0)
nk.c0 = nkc0 * CFrame.Angles(-math.cos(t / 2.5 * speed) / 40, 0, 0)
ls.c0 = lsc0 * CFrame.new(-0.1, -math.cos(t / 2.5 * speed) / 7.5, -0.05) * CFrame.Angles(-math.sin(t / 5 * speed), math.rad(3), -math.rad(5))
if weaponEquip == true then
rs.c0 = rsc0 * CFrame.new(0, -math.cos(t / 2.5 * speed) / 7.5, -0.05) * CFrame.Angles(math.rad(90) + -math.cos(t / 2.5 * speed) / 50, 0, 0)
elseif weaponEquip == false then
rs.c0 = rsc0 * CFrame.new(0.1, -math.cos(t / 2.5 * speed) / 7.5, -0.05) * CFrame.Angles(math.sin(t / 5 * speed), -math.rad(5), math.rad(7))
end
lh.c0 = lhc0 * CFrame.new(0, 0.25 + math.cos(t / 5 * speed) / 3, -0.125 - math.cos(t / 5 * speed) / 6) * CFrame.Angles(-math.rad(8) + math.sin(t / 5 * speed), math.rad(9), -math.rad(7))
rh.c0 = rhc0 * CFrame.new(0, 0.25 - math.cos(t / 5 * speed) / 3, -0.125 + math.cos(t / 5 * speed) / 6) * CFrame.Angles(-math.rad(8) - math.sin(t / 5 * speed), -math.rad(7), math.rad(9))
else
rj.c0 = rjc0
nk.c0 = nkc0
ls.c0 = lsc0 * CFrame.new(0, 0, -0.05) * CFrame.Angles(-math.cos(t / 40) / 40, math.rad(3), -math.rad(5) + math.sin(t / 40) / 40)
if weaponEquip == true then
rs.c0 = rsc0 * CFrame.new(0, 0, -0.05) * CFrame.Angles(math.rad(90), 0, 0)
elseif weaponEquip == false then
rs.c0 = rsc0 * CFrame.new(0, 0, -0.05) * CFrame.Angles(math.cos(t / 40) / 40, -math.rad(5), math.rad(7) - math.sin(t / 40) / 40)
end
lh.c0 = lhc0 * CFrame.Angles(0, math.rad(9), -math.rad(7))
rh.c0 = rhc0 * CFrame.Angles(0, -math.rad(7), math.rad(9))
end
end
cam.CFrame = root.CFrame * CFrame.new(0, 1.5, 0)
if shooting == true and weaponEquip == true then
if currentWeapon == "blaster" then
if (os.clock() - lastShot) > 0.3 then
blast()
lastShot = os.clock()
end
elseif currentWeapon == "sword" then
if (os.clock() - lastSwing) > 0.5 then
swing()
lastSwing = os.clock()
end
end
end
for _, bullet in pairs(blastBullets) do
if bullet then
local result = workspace:Raycast(bullet.Position, bullet.CFrame.LookVector * 10, raycastParams)
if result then
local hurtChr = result.Instance:FindFirstAncestorWhichIsA("Model")
if hurtChr and hurtChr:FindFirstChildWhichIsA("Humanoid") and blastCharge == false then
local hHum = hurtChr:FindFirstChildWhichIsA("Humanoid")
hHum:TakeDamage(hHum.MaxHealth / 4)
elseif blastCharge == true then
blastCharge = false
local explosion = Instance.new("Part")
explosion.Color = blaster.Color
explosion.Transparency = 0.125
explosion.Size = Vector3.new(15, 15, 15)
explosion.Shape = Enum.PartType.Ball
explosion.Material = Enum.Material.Neon
explosion.Anchored = true
explosion.Locked = true
explosion.CanCollide = false
explosion.CFrame = bullet.CFrame
explosion.Parent = script
local expTween = game:GetService("TweenService"):Create(
explosion,
TweenInfo.new(2, Enum.EasingStyle.Exponential),
{Transparency = 1, Size = Vector3.new(30, 30, 30)}
):Play()
for _, v in pairs(workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local hurtRoot = v:FindFirstChild("HumanoidRootPart")
local hurtHum = v:FindFirstChild("Humanoid")
if (explosion.Position - hurtRoot.Position).Magnitude < 15 then
v:BreakJoints()
for _, hurtChr in pairs(v:GetDescendants()) do
if hurtChr:IsA("BasePart") then
local att = Instance.new("Attachment")
att.Parent = hurtChr
local linearVel = Instance.new("LinearVelocity")
linearVel.MaxForce = 9e9
linearVel.VectorVelocity = Vector3.new(Random.new():NextNumber(-100, 100), Random.new():NextNumber(-100, 100), Random.new():NextNumber(-100, 100))
linearVel.Attachment0 = att
linearVel.Parent = hurtChr
game:GetService("Debris"):AddItem(linearVel, 0.2)
end
end
end
end
end
local explodeSound = explode:Clone()
explodeSound.Parent = explosion
explodeSound:Play()
game:GetService("Debris"):AddItem(explosion, 2)
game:GetService("Debris"):AddItem(explodeSound, explodeSound.TimeLength)
end
table.remove(blastBullets, _)
bullet:Destroy()
end
end
bullet.CFrame = bullet.CFrame * CFrame.new(0, -0.01, -10) * CFrame.Angles(-0.005, 0, 0)
end
if (os.clock() - lastShot) > 2 then
blastCharge = true
end
if fakeChr.Parent and fakeChr.Parent:IsA("ViewportFrame") then
refit = true
end
if refit == true then
for _, p in pairs(script:GetDescendants()) do
if p:IsA("BasePart") then
p:Destroy()
end
end
print('refitted')
refit = false
enforceChr()
end
enforceChr()
end
end)
end)
--[[local remote = Instance.new("RemoteEvent")
remote.Name = "KeybindConnection"
remote.Parent = owner.PlayerGui
NLS(local s = workspace:FindFirstChild("fakeChrModel" .. owner.Name)
local fc = workspace:FindFirstChild("fakeChr" .. owner.Name)
local remote = script.Parent:WaitForChild("KeybindConnection")
local UIS = game:GetService("UserInputService")
workspace.CurrentCamera.CameraSubject = s:WaitForChild("c")
s.DescendantAdded:Connect(function(ch)
if ch.Name == "c" then
workspace.CurrentCamera.CameraSubject = ch
end
end)
UIS.InputBegan:connect(function(key, g)
if not g then
if key.UserInputType == Enum.UserInputType.MouseButton1 then
remote:FireServer("mouse1", "keydown")
elseif key.UserInputType == Enum.UserInputType.Keyboard then
remote:FireServer(key.KeyCode, "keydown")
end
end
end)
UIS.InputEnded:connect(function(key, g)
if not g then
if key.UserInputType == Enum.UserInputType.MouseButton1 then
remote:FireServer("mouse1", "keyup")
elseif key.UserInputType == Enum.UserInputType.Keyboard then
remote:FireServer(key.KeyCode, "keyup")
end
end
end), owner.PlayerGui)
remote.OnServerEvent:Connect(function(plr, key, input)
if key == Enum.KeyCode.Q then
if input == "keydown" then
if weaponEquip == true and currentWeapon == "blaster" then
weaponEquip = false
else
currentWeapon = "blaster"
weaponEquip = true
end
end
elseif key == Enum.KeyCode.E then
if input == "keydown" then
if weaponEquip == true and currentWeapon == "sword" then
weaponEquip = false
else
currentWeapon = "sword"
weaponEquip = true
end
end
elseif key == "mouse1" then
if input == "keydown" then
shooting = true
elseif input == "keyup" then
shooting = false
end
end
end)]]