Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FilteringEnabled preventing this script from working the way I set it up. Any ways I can fix it?

Asked by
Jo_Bot 67
6 years ago
Edited 6 years ago

I have a local script that turns my character into a ragdoll on a keypress, and it works for the client, but not the server(Only the player sees it, no one else sees their ragdoll). I have it inside of StarterCharacterScripts.

here is my script(lol don't steal it!):

wait(2)
local chr = script.Parent
local player = game.Players:GetPlayerFromCharacter(chr)

local humanoid = player.Character.Humanoid

local UIS = game:GetService("UserInputService")
local cam = game.Workspace.CurrentCamera
local mouse = player:GetMouse()

In = false

UIS.InputBegan:connect(function(key)
    while key.KeyCode == Enum.KeyCode.Q and chr.Parent == game.Workspace do
        print("Ragdoll")
        cam.CameraType = Enum.CameraType.Follow

        chr.Parent = game.Lighting
        Folder = Instance.new("Folder")
        Folder.Parent = game.Workspace
        Folder.Name = player.Name,"Ragdoll"
        Head = chr.Head:Clone()
        LowerTorso = chr.LowerTorso:Clone()
        UpperTorso = chr.UpperTorso:Clone()
        LeftUpperArm = chr.LeftUpperArm:Clone()
        LeftLowerArm = chr.LeftLowerArm:Clone()
        RightUpperArm = chr.RightUpperArm:Clone()
        RightLowerArm = chr.RightLowerArm:Clone()
        LeftUpperLeg = chr.LeftUpperLeg:Clone()
        LeftLowerLeg = chr.LeftLowerLeg:Clone()
        RightUpperLeg = chr.RightUpperLeg:Clone()
        RightLowerLeg = chr.RightLowerLeg:Clone()
        LeftFoot = chr.LeftFoot:Clone()
        LeftHand = chr.LeftHand:Clone()
        RightFoot = chr.RightFoot:Clone()
        RightHand = chr.RightHand:Clone()
        cam.CameraSubject = Head

        Head.CanCollide = true
        LowerTorso.CanCollide = true
        UpperTorso.CanCollide = true
        LeftUpperArm.CanCollide = true
        LeftLowerArm.CanCollide = true
        RightUpperArm.CanCollide = true
        RightLowerArm.CanCollide = true
        LeftUpperLeg.CanCollide = true
        LeftLowerLeg.CanCollide = true
        RightUpperLeg.CanCollide = true
        RightLowerLeg.CanCollide = true
        LeftFoot.CanCollide = true
        LeftHand.CanCollide = true
        RightFoot.CanCollide = true
        RightHand.CanCollide = true

        Head.Parent = Folder
        LowerTorso.Parent = Folder
        UpperTorso.Parent = Folder
        LeftUpperArm.Parent = Folder
        LeftLowerArm.Parent = Folder
        RightUpperArm.Parent = Folder
        RightLowerArm.Parent = Folder
        LeftUpperLeg.Parent = Folder
        LeftLowerLeg.Parent = Folder
        RightUpperLeg.Parent = Folder
        RightLowerLeg.Parent = Folder
        LeftFoot.Parent = Folder
        LeftHand.Parent = Folder
        RightFoot.Parent = Folder
        RightHand.Parent = Folder

        Neck = Instance.new("BallSocketConstraint",UpperTorso)
        Waist = Instance.new("BallSocketConstraint",LowerTorso)
        LeftShoulder = Instance.new("BallSocketConstraint",UpperTorso)
        RightShoulder = Instance.new("BallSocketConstraint",UpperTorso)
        LeftHip = Instance.new("BallSocketConstraint",LowerTorso)
        RightHip = Instance.new("BallSocketConstraint",LowerTorso)
        LeftElbow = Instance.new("BallSocketConstraint",UpperTorso)
        RightElbow = Instance.new("BallSocketConstraint",UpperTorso)
        LeftKnee = Instance.new("BallSocketConstraint",LowerTorso)
        RightKnee = Instance.new("BallSocketConstraint",LowerTorso)
        LeftWrist = Instance.new("BallSocketConstraint",UpperTorso)
        RightWrist = Instance.new("BallSocketConstraint",UpperTorso)
        LeftAnkle = Instance.new("BallSocketConstraint",LowerTorso)
        RightAnkle = Instance.new("BallSocketConstraint",LowerTorso)

        Neck.LimitsEnabled = true
        Waist.LimitsEnabled = true
        LeftShoulder.LimitsEnabled = true
        RightShoulder.LimitsEnabled = true
        LeftHip.LimitsEnabled = true
        RightHip.LimitsEnabled = true
        LeftElbow.LimitsEnabled = true
        LeftKnee.LimitsEnabled = true
        RightKnee.LimitsEnabled = true
        LeftWrist.LimitsEnabled = true
        RightWrist.LimitsEnabled = true
        LeftAnkle.LimitsEnabled = true
        RightAnkle.LimitsEnabled = true

        Neck.Attachment0 = Folder.UpperTorso.NeckRigAttachment
        Neck.Attachment1 = Folder.Head.NeckRigAttachment

        Waist.Attachment0 = Folder.LowerTorso.WaistRigAttachment
        Waist.Attachment1 = Folder.UpperTorso.WaistRigAttachment

        LeftShoulder.Attachment0 = Folder.UpperTorso.LeftShoulderRigAttachment
        LeftShoulder.Attachment1 = Folder.LeftUpperArm.LeftShoulderRigAttachment

        RightShoulder.Attachment0 = Folder.UpperTorso.RightShoulderRigAttachment
        RightShoulder.Attachment1 = Folder.RightUpperArm.RightShoulderRigAttachment

        LeftHip.Attachment0 = Folder.LowerTorso.LeftHipRigAttachment
        LeftHip.Attachment1 = Folder.LeftUpperLeg.LeftHipRigAttachment

        RightHip.Attachment0 = Folder.LowerTorso.RightHipRigAttachment
        RightHip.Attachment1 = Folder.RightUpperLeg.RightHipRigAttachment


        LeftElbow.Attachment0 = Folder.LeftUpperArm.LeftElbowRigAttachment
        LeftElbow.Attachment1 = Folder.LeftLowerArm.LeftElbowRigAttachment

        RightElbow.Attachment0 = Folder.RightUpperArm.RightElbowRigAttachment
        RightElbow.Attachment1 = Folder.RightLowerArm.RightElbowRigAttachment

        LeftKnee.Attachment0 = Folder.LeftUpperLeg.LeftKneeRigAttachment
        LeftKnee.Attachment1 = Folder.LeftLowerLeg.LeftKneeRigAttachment

        RightKnee.Attachment0 = Folder.RightUpperLeg.RightKneeRigAttachment
        RightKnee.Attachment1 = Folder.RightLowerLeg.RightKneeRigAttachment

        LeftWrist.Attachment0 = Folder.LeftLowerArm.LeftWristRigAttachment
        LeftWrist.Attachment1 = Folder.LeftHand.LeftWristRigAttachment

        RightWrist.Attachment0 = Folder.RightLowerArm.RightWristRigAttachment
        RightWrist.Attachment1 = Folder.RightHand.RightWristRigAttachment

        LeftAnkle.Attachment0 = Folder.LeftLowerLeg.LeftAnkleRigAttachment
        LeftAnkle.Attachment1 = Folder.LeftFoot.LeftAnkleRigAttachment

        RightAnkle.Attachment0 = Folder.RightLowerLeg.RightAnkleRigAttachment
        RightAnkle.Attachment1 = Folder.RightFoot.RightAnkleRigAttachment
        In = true
        print(In)
        wait(.1)
        UIS.InputBegan:connect(function(key)
            if key.KeyCode == Enum.KeyCode.C and chr.Parent == game.Lighting then
                print("Stand")
                chr.Parent = game.Workspace
                chr.LowerTorso.CFrame = CFrame.new(Folder.Head.CFrame.x,Folder.Head.CFrame.y + 3, Folder.Head.CFrame.z)
                Folder:Destroy()
                In = false
                print(In)

            end

        end)
    end 
end)
0
Oh, and I need FE, because I do not want exploiters exploiting my game. Jo_Bot 67 — 6y
0
cool free ragdoll script1 hellmatic 1523 — 6y
0
god dangit sickings :D (you are not being serious are you, if so, I can track anybody and you are going down) Jo_Bot 67 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

What you can do is use Remote Events to do this

Have this in a local script

local chr = script.Parent
local player = game.players.LocalPlayer
local Event = Whereever it is located
local UIS = game:GetService("UserInputService")

UIS.InputBegan:connect(function(key)
    while key.KeyCode == Enum.KeyCode.Q and chr.Parent == game.Workspace do
        Event:FireServer(player)
    end
end

Server Script

local Event = Whereever it is located
Event.OnServerEvent:Connect(Function(player)
    script and stuff
end)

Because I dont have access to my studio right now I am 50% unsure if this will even work. But you are probably going to need to modify it a bit in order to have it work. Sorry If I wasn't much help.

0
what should the event be? And no need to be sorry, you have helped me greatly! Jo_Bot 67 — 6y
0
You should use a remote event for this, dont see why any other event would work. Sergiomontani10 236 — 6y
Ad

Answer this question