This script is supposed to control the local player but is controlling other players and not the local player. Script is in a local script as well.
Can anyone help me out?
Code:
local MMUOn = true
local EMUOn = true
local player = game.Players.LocalPlayer
local character = player.Character
local function _MMUOn()
script.Parent.MainMMU.Disabled = false
print("MMU ON")
for i, v in pairs(character.MMUGroup:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = false
v.Transparency = 0
if v.Material == Enum.Material.Glass then
v.Transparency = 0.6
end
elseif v:IsA("Decal") and v.Texture == "rbxassetid://5775656101" then
v.Transparency = 0.85
end
end
end
local function _MMUOff()
script.Parent.MainMMU.Disabled = true
if character.Torso.BodyVelocity then
character.Torso.BodyVelocity:Destroy()
end
if character.Torso.BodyAngularVelocity then
character.Torso.BodyAngularVelocity:Destroy()
end
print("MMU OFF")
for i, v in pairs(character.MMUGroup:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = false
v.Transparency = 1
elseif v:IsA("Decal") then
v.Transparency = 1
elseif v:IsA("TextLabel") then
v.TextTransparency = 1
end
end
end
local function _EMUOn()
print("EMU ON")
for i, v in pairs(character.EMUGroup:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = false
v.Transparency = 0
if v.Material == Enum.Material.Glass then
v.Transparency = 0.6
end
elseif v:IsA("Decal") and v.Texture == "rbxassetid://5775656101" then
v.Transparency = 0.85
end
end
end
local function _EMUOff()
print("EMU OFF")
for i, v in pairs(character.EMUGroup:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = false
v.Transparency = 1
elseif v:IsA("Decal") then
v.Transparency = 1
end
end
end
script.Parent.EMU.MouseButton1Click:Connect(function()
EMUOn = not EMUOn
if EMUOn then
_EMUOn()
else
_EMUOff()
end
end)
script.Parent.MMU.MouseButton1Click:Connect(function()
MMUOn = not MMUOn
if MMUOn then
_MMUOn()
else
_MMUOff()
end
end)