Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't my localscript work outside build mode?

Asked by 10 years ago
local enabled = true
Player = script.Parent.Parent
character = Player.CharacterAdded:wait();
mouse = Player:GetMouse()
RightShoulder = Player.Character.Torso["Right Shoulder"]
LeftShoulder = Player.Character.Torso["Left Shoulder"]

function onKeyDown(key)
    key = key:lower()
    if key == "x" then
        game:GetService("Chat"):Chat(Player.Character.Head,"Heaven!")
        for i = 1,2 do
            RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 10)
            wait(0.25)
            RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -10)
        end
        game:GetService("Chat"):Chat(Player.Character.Head,"Hell!")
        for i = 1,2 do
            LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 10)
            wait(0.25)
            LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -10)
        end
        game:GetService("Chat"):Chat(Player.Character.Head,"Crash!")
        b = Instance.new ("Part")
        b.BrickColor = BrickColor.new("Bright violet")
        b.Shape = "Ball"
        b.Size = Vector3.new(3, 3, 3)
        b.TopSurface = "Smooth"
        b.BottomSurface = "Smooth"
        b.CanCollide = false
        b.Anchored = false
        b.CFrame = Player.Character.Torso.CFrame *CFrame.new(0, 0, -12)
        b.Parent = workspace
        game.Debris:AddItem(b,6)
        b2 = Instance.new("Part")
        b2.BrickColor = BrickColor.new("Lavender")
        b2.Shape = "Ball"
        b2.Size = Vector3.new(5, 5, 5)
        b2.TopSurface = "Smooth"
        b2.BottomSurface = "Smooth"
        b2.Transparency = 0.7
        b2.CanCollide = false
        b2.Anchored = false
        b2.CFrame = Player.Character.Torso.CFrame *CFrame.new(0, 0, -12)
        b2.Parent = b
        game.Debris:AddItem(b2,6)
        y = Instance.new("BodyVelocity")
        y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        y.velocity = Player.Character.Torso.CFrame.lookVector*80
        y.Parent = b
        f = Instance.new("Fire")
        f.Size = 5
        f.Heat = 15
        f.Color = Color3.new(101, 101, 152)
        f.SecondaryColor = Color3.new(170, 170, 255)
        f.Parent = b        
        weld = Instance.new("Weld")
        weld.Part0 = b2
        --weld.C0 = b2.CFrame:inverse()
        weld.Part1 = b
        weld.Parent = b
    end
end

mouse.KeyDown:connect(onKeyDown)
0
To boba,look at the tags first please u.u kingalpha1 15 — 10y

1 answer

Log in to vote
0
Answered by
SirGory 15
10 years ago

I find this a lot, it can be very irritating but to use the :GetMouse()function the Player has to be a Local Player

local plr=game.Players.LocalPlayer

If this didn't work try this

repeat wait() until game:GetService("Players")
repeat wait() until game:GetService("Players").LocalPlayer
local plr=game:GetService("Players").LocalPlayer
0
Hm,didn't work...some of my scripts started to work again but not the one i wanted kingalpha1 15 — 10y
0
I've added another script, see if it works this time. SirGory 15 — 10y
Ad

Answer this question