I'm making a ragdoll game and was wondering how to make this script filtering enabled. (I know it could be shorter.)
wait(1) local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local function onKeyDown(key) key = key:lower() if key == "q" then if mouse.Target.Parent.Name == "Meaty" then local mt = mouse.Target mt.Parent.LeftUpperLeg.Transparency = .1 mt.Parent.LeftFoot.Transparency = .1 mt.Parent.LeftHand.Transparency = .1 mt.Parent.LeftLowerArm.Transparency = .1 mt.Parent.LeftLowerLeg.Transparency = .1 mt.Parent.LeftUpperArm.Transparency = .1 mt.Parent.LowerTorso.Transparency = .1 mt.Parent.RightFoot.Transparency = .1 mt.Parent.RightHand.Transparency = .1 mt.Parent.RightLowerArm.Transparency = .1 mt.Parent.RightLowerLeg.Transparency = .1 mt.Parent.RightUpperArm.Transparency = .1 mt.Parent.RightUpperLeg.Transparency = .1 mt.Parent.UpperTorso.Transparency = .1 mt.Parent.Head.Transparency = .1 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .2 mt.Parent.LeftFoot.Transparency = .2 mt.Parent.LeftHand.Transparency = .2 mt.Parent.LeftLowerArm.Transparency = .2 mt.Parent.LeftLowerLeg.Transparency = .2 mt.Parent.LeftUpperArm.Transparency = .2 mt.Parent.LowerTorso.Transparency = .2 mt.Parent.RightFoot.Transparency = .2 mt.Parent.RightHand.Transparency = .2 mt.Parent.RightLowerArm.Transparency = .2 mt.Parent.RightLowerLeg.Transparency = .2 mt.Parent.RightUpperArm.Transparency = .2 mt.Parent.RightUpperLeg.Transparency = .2 mt.Parent.UpperTorso.Transparency = .2 mt.Parent.Head.Transparency = .2 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .3 mt.Parent.LeftFoot.Transparency = .3 mt.Parent.LeftHand.Transparency = .3 mt.Parent.LeftLowerArm.Transparency = .3 mt.Parent.LeftLowerLeg.Transparency = .3 mt.Parent.LeftUpperArm.Transparency = .3 mt.Parent.LowerTorso.Transparency = .3 mt.Parent.RightFoot.Transparency = .3 mt.Parent.RightHand.Transparency = .3 mt.Parent.RightLowerArm.Transparency = .3 mt.Parent.RightLowerLeg.Transparency = .3 mt.Parent.RightUpperArm.Transparency = .3 mt.Parent.RightUpperLeg.Transparency = .3 mt.Parent.UpperTorso.Transparency = .3 mt.Parent.Head.Transparency = .3 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .4 mt.Parent.LeftFoot.Transparency = .4 mt.Parent.LeftHand.Transparency = .4 mt.Parent.LeftLowerArm.Transparency = .4 mt.Parent.LeftLowerLeg.Transparency = .4 mt.Parent.LeftUpperArm.Transparency = .4 mt.Parent.LowerTorso.Transparency = .4 mt.Parent.RightFoot.Transparency = .4 mt.Parent.RightHand.Transparency = .4 mt.Parent.RightLowerArm.Transparency = .4 mt.Parent.RightLowerLeg.Transparency = .4 mt.Parent.RightUpperArm.Transparency = .4 mt.Parent.RightUpperLeg.Transparency = .4 mt.Parent.UpperTorso.Transparency = .4 mt.Parent.Head.Transparency = .4 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .5 mt.Parent.LeftFoot.Transparency = .5 mt.Parent.LeftHand.Transparency = .5 mt.Parent.LeftLowerArm.Transparency = .5 mt.Parent.LeftLowerLeg.Transparency = .5 mt.Parent.LeftUpperArm.Transparency = .5 mt.Parent.LowerTorso.Transparency = .5 mt.Parent.RightFoot.Transparency = .5 mt.Parent.RightHand.Transparency = .5 mt.Parent.RightLowerArm.Transparency = .5 mt.Parent.RightLowerLeg.Transparency = .5 mt.Parent.RightUpperArm.Transparency = .5 mt.Parent.RightUpperLeg.Transparency = .5 mt.Parent.UpperTorso.Transparency = .5 mt.Parent.Head.Transparency = .5 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .6 mt.Parent.LeftFoot.Transparency = .6 mt.Parent.LeftHand.Transparency = .6 mt.Parent.LeftLowerArm.Transparency = .6 mt.Parent.LeftLowerLeg.Transparency = .6 mt.Parent.LeftUpperArm.Transparency = .6 mt.Parent.LowerTorso.Transparency = .6 mt.Parent.RightFoot.Transparency = .6 mt.Parent.RightHand.Transparency = .6 mt.Parent.RightLowerArm.Transparency = .6 mt.Parent.RightLowerLeg.Transparency = .6 mt.Parent.RightUpperArm.Transparency = .6 mt.Parent.RightUpperLeg.Transparency = .6 mt.Parent.UpperTorso.Transparency = .6 mt.Parent.Head.Transparency = .6 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .7 mt.Parent.LeftFoot.Transparency = .7 mt.Parent.LeftHand.Transparency = .7 mt.Parent.LeftLowerArm.Transparency = .7 mt.Parent.LeftLowerLeg.Transparency = .7 mt.Parent.LeftUpperArm.Transparency = .7 mt.Parent.LowerTorso.Transparency = .7 mt.Parent.RightFoot.Transparency = .7 mt.Parent.RightHand.Transparency = .7 mt.Parent.RightLowerArm.Transparency = .7 mt.Parent.RightLowerLeg.Transparency = .7 mt.Parent.RightUpperArm.Transparency = .7 mt.Parent.RightUpperLeg.Transparency = .7 mt.Parent.UpperTorso.Transparency = .7 mt.Parent.Head.Transparency = .7 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .8 mt.Parent.LeftFoot.Transparency = .8 mt.Parent.LeftHand.Transparency = .8 mt.Parent.LeftLowerArm.Transparency = .8 mt.Parent.LeftLowerLeg.Transparency = .8 mt.Parent.LeftUpperArm.Transparency = .8 mt.Parent.LowerTorso.Transparency = .8 mt.Parent.RightFoot.Transparency = .8 mt.Parent.RightHand.Transparency = .8 mt.Parent.RightLowerArm.Transparency = .8 mt.Parent.RightLowerLeg.Transparency = .8 mt.Parent.RightUpperArm.Transparency = .8 mt.Parent.RightUpperLeg.Transparency = .8 mt.Parent.UpperTorso.Transparency = .8 mt.Parent.Head.Transparency = .8 wait(.01) mt.Parent.LeftUpperLeg.Transparency = .9 mt.Parent.LeftFoot.Transparency = .9 mt.Parent.LeftHand.Transparency = .9 mt.Parent.LeftLowerArm.Transparency = .9 mt.Parent.LeftLowerLeg.Transparency = .9 mt.Parent.LeftUpperArm.Transparency = .9 mt.Parent.LowerTorso.Transparency = .9 mt.Parent.RightFoot.Transparency = .9 mt.Parent.RightHand.Transparency = .9 mt.Parent.RightLowerArm.Transparency = .9 mt.Parent.RightLowerLeg.Transparency = .9 mt.Parent.RightUpperArm.Transparency = .9 mt.Parent.RightUpperLeg.Transparency = .9 mt.Parent.UpperTorso.Transparency = .9 mt.Parent.Head.Transparency = .9 wait(.01) mt.Parent:destroy() end end end mouse.KeyDown:connect(onKeyDown)
Hello, CatGosCrazy!
You need to use remote events to make the action enabled to all players, working scripts:
Local Script
wait(1) local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local UIS = game:GetService("UserInputService") function onKeyDown(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print(mouse.Target.Parent.Name) if mouse.Target.Parent.Name == "Meaty" then game.ReplicatedStorage.RemovePartEvent:FireServer(mouse.Target) end end end game.ContextActionService:BindAction("keyPress", onKeyDown, false, Enum.KeyCode.Q)
Normal Script
local Event = Instance.new("RemoteEvent") Event.Parent = game.ReplicatedStorage Event.Name = "RemovePartEvent" function RemovePart(Part) local mt = Part for i = 1, 10 do mt.Parent.LeftUpperLeg.Transparency = i / 10 mt.Parent.LeftFoot.Transparency = i / 10 mt.Parent.LeftHand.Transparency = i / 10 mt.Parent.LeftLowerArm.Transparency = i / 10 mt.Parent.LeftLowerLeg.Transparency = i / 10 mt.Parent.LeftUpperArm.Transparency = i / 10 mt.Parent.LowerTorso.Transparency = i / 10 mt.Parent.RightFoot.Transparency = i / 10 mt.Parent.RightHand.Transparency = i / 10 mt.Parent.RightLowerArm.Transparency = i / 10 mt.Parent.RightLowerLeg.Transparency = i / 10 mt.Parent.RightUpperArm.Transparency = i / 10 mt.Parent.RightUpperLeg.Transparency = i / 10 mt.Parent.UpperTorso.Transparency = i / 10 mt.Parent.Head.Transparency = i / 10 wait(.01) end mt.Parent:destroy() end Event.OnServerEvent:Connect(RemovePart)