I have a stance script,its a local one and its placed in StarterGui ,Filtering Enabled. THe problem is,that , when you press the keys you can see how you crouch etc,but other players cant,Whats the problem?
repeat wait() until game.Players.LocalPlayer.Character
repeat wait(1) until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)
wait(4 / 20)
local Player = game.Players.LocalPlayer
local player = game.Players.LocalPlayer
local Character = Player.Character
local char = Player.Character
local Humanoid = Character.Humanoid
local Mouse = Player:GetMouse()
local mouse = Player:GetMouse()
local Camera = game.Workspace.CurrentCamera
local HumanoidRootPart = Character.HumanoidRootPart
local Torso = Character.Torso
local Neck = Torso:WaitForChild("Neck")
game.Players.LocalPlayer.CameraMaxZoomDistance = 15
game.Players.LocalPlayer.CameraMinZoomDistance = 0
local NightVision = false
local AltPressed = false
local Stances = 0
_G.SteadyStance = false
_G.LeanR = 0
_G.LeanL = 0
local RAW
local LAW
local RootPart = char:WaitForChild("HumanoidRootPart")
local RootJoint = RootPart.RootJoint
RootJoint.C0 = CFrame.new()
RootJoint.C1 = CFrame.new()
local Aiming = false
local ZoomDistance = 40
local NV
local RS = game:GetService("RunService")
function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
spawn(function()
local newCode = math.random(-1e9, 1e9)
local tweenIndicator = nil
if (not Joint:findFirstChild("tweenCode")) then
tweenIndicator = Instance.new("IntValue")
tweenIndicator.Name = "tweenCode"
tweenIndicator.Value = newCode
tweenIndicator.Parent = Joint
else
tweenIndicator = Joint.tweenCode
tweenIndicator.Value = newCode
end
if Duration <= 0 then
if newC0 then Joint.C0 = newC0 end
if newC1 then Joint.C1 = newC1 end
else
local Increment = 1.5 / Duration
local startC0 = Joint.C0
local startC1 = Joint.C1
local X = 0
while true do
RS.RenderStepped:wait()
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if tweenIndicator.Value ~= newCode then break end
if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
if X == 90 then break end
end
end
if tweenIndicator.Value == newCode then
tweenIndicator:Destroy()
end
end)
end
function CreateWeld(Part, CF)
local w = Instance.new("Weld")
w.Name = "LegWeld"
w.Parent = Torso
w.Part0 = Torso
w.Part1 = Part
tweenJoint(w, nil, CF, function(X) return math.sin(math.rad(X)) end, 0.25)
end
local RS = Torso["Right Shoulder"]
local LS = Torso["Left Shoulder"]
local RH = char["Torso"]:WaitForChild("Right Hip")
local LH = char["Torso"]:WaitForChild("Left Hip")
local LeftLeg = char["Left Leg"]
local RightLeg = char["Right Leg"]
local Proned2
function TweenCOffset(CO, t)
coroutine.resume(coroutine.create(function()
COn = COn and COn + 1 or 0 local COn_S = COn
for i = 1, t do
if COn ~= COn_S then break end
char.Humanoid.CameraOffset = char.Humanoid.CameraOffset + (CO - char.Humanoid.CameraOffset) * (i / t)
game:GetService("RunService").RenderStepped:wait()
end
end))
end
function TweenTransparency(Part,Trans, t)
coroutine.resume(coroutine.create(function()
COn = COn and COn + 1 or 0 local COn_S = COn
for i = 1, t do
if COn ~= COn_S then break end
Part.Transparency = Part.Transparency + (Trans - Part.Transparency) * (i / t)
game:GetService("RunService").RenderStepped:wait()
end
end))
end
function TweenColor(Part,Color, t)
coroutine.resume(coroutine.create(function()
COn = COn and COn + 1 or 0 local COn_S = COn
for i = 1, t do
if COn ~= COn_S then break end
Part.BrickColor = Part.BrickColor + (Color - Part.BrickColor) * (i / t)
game:GetService("RunService").RenderStepped:wait()
end
end))
end
function Stand()
TweenCOffset(Vector3.new(0,0,0), 20)
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50
IsStanced = false
LH.Part1 = LeftLeg
RH.Part1 = RightLeg
Proned2 = Vector3.new(0,0,0)
tweenJoint(RootJoint, CFrame.new()* CFrame.Angles(math.rad(-0),0,math.rad(0)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RH, CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LH, CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RS, CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
for i, s in pairs(Torso:GetChildren()) do
if (s.Name == "LegWeld") and (s.ClassName == "Weld") then
s:Destroy()
end
end
end
function StandEquip()
TweenCOffset(Vector3.new(0,0,0), 20)
Humanoid.WalkSpeed = 12
Humanoid.JumpPower = 30
IsStanced = false
LH.Part1 = LeftLeg
RH.Part1 = RightLeg
Proned2 = Vector3.new(0,0,0)
tweenJoint(RootJoint, CFrame.new(0,0,0.275)* CFrame.Angles(math.rad(-10),0,math.rad(0)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RH, CFrame.new(1,-1,-0.15)* CFrame.Angles(math.rad(20),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LH, CFrame.new(-1,-1,-0.2)* CFrame.Angles(math.rad(-10),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RS, CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
for i, s in pairs(Torso:GetChildren()) do
if (s.Name == "LegWeld") and (s.ClassName == "Weld") then
s:Destroy()
end
end
end
function Crouch()
TweenCOffset(Vector3.new(0, -1,0), 20)
Humanoid.WalkSpeed = 8
Humanoid.JumpPower = 10
for i, s in pairs(Torso:GetChildren()) do
if (s.Name == "LegWeld") and (s.ClassName == "Weld") then
s:Destroy()
end
end
IsStanced = true
RH.Part1 = RightLeg
LH.Part1 = LeftLeg
Proned2 = Vector3.new(0,0,0)
tweenJoint(RootJoint, CFrame.new(0,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(0)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RH, CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LH, CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RS, CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
end
function Prone()
TweenCOffset(Vector3.new(0, -3.25, 0), 20)
Humanoid.WalkSpeed = 4
Humanoid.JumpPower = 0
IsStanced = true
RH.Part1 = nil
LH.Part1 = nil
Proned2 = Vector3.new(0,0.5,0.5)
tweenJoint(RootJoint, CFrame.new(0,-2.5,1.35)* CFrame.Angles(math.rad(-90),0,math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RS, CFrame.new(0.9,1.1,0)* CFrame.Angles(math.rad(-180),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(-0.9,1.1,0)* CFrame.Angles(math.rad(-180),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
CreateWeld(RightLeg, CFrame.new(-0.2,1.85,0)* CFrame.Angles(math.rad(-0),0,math.rad(-20)))
CreateWeld(LeftLeg, CFrame.new(0.2,1.85,0)* CFrame.Angles(math.rad(-0),0,math.rad(20)))
end
local AlreadyProned = false
mouse.KeyDown:connect(function(Key)
if Key == "c" and Stances == 0 and not _G.Sprinting and not _G.Lean then
Stances = 1
Crouch()
_G.Crouched = true
elseif Key == "c" and Stances == 1 and not _G.Sprinting and not _G.Lean then
Stances = 2
Prone()
_G.Crouched = false
_G.Proned = true
elseif Key == "x" and Stances == 2 and not _G.Sprinting and not _G.Lean then
_G.Crouched = true
_G.Proned = false
Stances = 1
Crouch()
elseif Key == "x" and Stances == 1 and not _G.Sprinting and not _G.Lean then
_G.Crouched = false
Stances = 0
if not _G.SteadyStance then
Stand()
elseif _G.SteadyStance then
StandEquip()
end
end
if Key == "z" and not _G.SteadyStance and Stances == 0 then
if not _G.Lean and Stances == 0 then
StandEquip()
end
_G.SteadyStance = true
elseif Key == "z" and _G.SteadyStance and Stances == 0 then
if not _G.Lean and Stances == 0 then
Stand()
end
_G.SteadyStance = false
end
if Key:byte() == 308 or Key:byte() == 307 then
AltPressed = true
print("Alt pressed")
end
end)
mouse.KeyUp:connect(function(Key)
if Key:byte() == 308 then
AltPressed = false
end
end)
Stand()
game:GetService("RunService").RenderStepped:connect(function()
Mouse.TargetFilter = game.Workspace
if Aiming then
game:GetService('UserInputService').MouseDeltaSensitivity = Player.PlayerGui:WaitForChild("ScreenGui").Frame.Sensitivity.Text
else
game:GetService('UserInputService').MouseDeltaSensitivity = 1
end
Mouse.Button2Down:connect(function()
if not Aiming then
Aiming = true
end
end)
Mouse.Button2Up:connect(function()
if Aiming then
Aiming = false
end
end)
end)

1 comment
Why though, try not to post such long lines of code. A lot of this is very useless, and I don''t even know where to look.