Here's the script:
local Player = script.Parent.Parent local me = Player local mouse = Player:GetMouse() active = false mouse.KeyDown:connect(function(key) if key == "r" then local ra = me.Character:FindFirstChild("Right Arm") local la = me.Character:FindFirstChild("Left Arm") local tr = me.Character:FindFirstChild("Torso") local ll = me.Character:FindFirstChild("Left Leg") local rl = me.Character:FindFirstChild("Right Leg") local aura1 = game.ReplicatedStorage.YamiA:Clone() aura1.Name = "aura1" aura1.Parent = ra -------- local aura2 = game.ReplicatedStorage.YamiA:Clone() aura2.Name = "aura2" aura2.Parent = la -------- local aura3 = game.ReplicatedStorage.YamiA:Clone() aura3.Name = "aura3" aura3.Parent = tr -------- local aura4 = game.ReplicatedStorage.YamiA:Clone() aura4.Name = "aura4" aura4.Parent = ll -------- local aura5 = game.ReplicatedStorage.YamiA:Clone() aura5.Name = "aura5" aura5.Parent = rl end end)
Problem | Solution |
---|---|
Mouse.KeyDown is deprecated |
Switch to UserInputService or ContextActionService |
connect is deprecated |
Switch to Connect |
local yami = game:GetService("ReplicatedStorage").YamiA local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local UIS = game:GetService"UserInputService" local enabled = false local names = { "Torso", "Left Arm", "Right Arm", "Left Leg", "Right Leg" } UIS.InputBegan:Connect(function(key, gpe) if gpe then return end if key.KeyCode == Enum.KeyCode.R then enabled = not enabled if enabled then for _, v in pairs(char:GetChildren())) do if v:IsA"BasePart" and names[v.Name] then yami:Clone().Parent = v end end end if not enabled then for _, v in pairs(char:GetChildren()) do if v:FindFirstChild"YamiA" then v.YamiA:Destroy() end end end end end)