This localscript is supposed to weld something to a player, if a value is changed to true, and remove it if it is change to false.
This is a local script in the workspace
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Magic = player.MagicEquiped -- There is a Boolvalue in the player called MagicEquiped
local playername = player.Name
mouse.KeyDown:connect(function(key) -- This bit here doesn't even work
if key == "q" then
if Magic == true then
Magic = false
elseif Magic == false then
Magic = true
end
end
end)
Magic.Changed:connect(function()
if Magic.Value == true then
local hit = game.Workspace[playername]
local LeftArm = hit["Left Arm"]
if hit:findFirstChild("Humanoid") ~= nil and LeftArm:findFirstChild("MyLeftArm") == nil then
g = game.Lighting.MyLeftArm:Clone()
g.Parent = LeftArm
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].ClassName == "UnionOperation" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = LeftArm
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0.05) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
Y.Parent = Y.Part0
end
end
elseif Magic.Value == false then
g:remove()
end
end)

5 comments
I haven't even looked at the script yet, I just read your introduction. This might be the error: LocalScripts don't run in Workspace.
I would like to confirm that, LOCAL SCRIPTS DO NOT RUN IN WORKSPACE!
Where would I put it? in the player? How would I get it there?
The best place to place this script is in either StarterGui or StarterPack.
It says that MagicEquiped is not a valid member of player, however when I look in the player, there is a boolvalue called 'MagicEquiped'