player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "q" then
for i = 0,0.5,.1 do
wait()
RightShoulder = game.Workspace.Player.Torso["Right Shoulder"]
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(0,-i,0)
end
for q = 0,0.5,.1 do
wait()
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(q,0,0)
end
wait()
for i = 0,0.5,.1 do
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(-i,0,0)
wait()
end
for i = 0,0.5,.1 do
RightShoulder.C0 = RightShoulder.C0 * CFrame.fromEulerAnglesXYZ(0,i,0)
wait()
end
for i = 3,45 do
wait()
earth = Instance.new("Part",workspace)
earth.Size = Vector3.new(4,4,4)
earth.CanCollide = false
earth.BrickColor = BrickColor.new("Reddish brown")
earth.Anchored = true
earth.CFrame = player.Character.Torso.CFrame * CFrame.new(0,0,-5+-i) * CFrame.fromEulerAnglesXYZ(math.random(),math.random(),math.random())
player.Character.Torso.Anchored = true
my = game.Lighting.Earth:Clone()
my.Parent = earth
end
player.Character.Torso.Anchored = false
end
end)
Why doesnt this work in Workspace?
3 answers
According to the Official ROBLOX Wiki:
"In order for a LocalScript to function, it must be placed within one of three areas:
In a player's Backpack (can be indirectly, through a Tool or HopperBin)
In a player's character model
In a player's PlayerGui "
So, by definition, a LocalScript will not run in the Workspace.
If you put that same code into a regular Script Instance, though, it still wouldn't work because it tries to make use of some client-only services, such as LocalPlayer and GetMouse().
LocalScript only work in the Character, Camera, and Player. Placing one in the workspace virtually disables it.
2 comments
The ROBLOX Wiki doesn't say that it'll run in the Camera, or the Player. It has to be in the PlayerGui, Character model, or Backpack.
Although it still works in all of the listed locations
You have to put the script in StarterGui for a LocalScript to work. Only Scripts run in workspace.
2 comments
A LocalScript runs in PlayerGui, Backpack, and the Player's Character model.
I know, but why downvote me? I stated a fact.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You may see i've gotten a lil bit better, this one doesnt work but all the other spells work. they're are all in seperate scripts and local