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

What is wrong with my keydown script?

Asked by 9 years ago
bin = script.Parent

me = script.Parent.Parent.Parent

local enabled = true
local bin = script.Parent
bin.Selected:connect(function(mouse)
    mouse.KeyDown:connect(function(key)
        if key == "c" then

        if enabled == false then
        return
    end

    enabled = false

    me.Character.Torso.Anchored = true
    RightShoulder = me.Character.Torso["Right Shoulder"]
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.1,0,0)
    wait(0.1)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.2,0,0)
    wait(0.1)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.3,0,0)
    wait(0.1)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.4,0,0)
    wait(0.1)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.5,0,0)
    wait(0.1)




        game:GetService("Chat"):Chat(me.Character.Head, "Survey the Heavens, Open the Heavens...")
    wait(0.5)
        game:GetService("Chat"):Chat(me.Character.Head, "Oh 88 Stars of the heaven...")
        wait(0.1)
        game:GetService("Chat"):Chat(me.Character.Head, "Shine!")
        wait(0.1)
        game:GetService("Chat"):Chat(me.Character.Head, "Urano Metria!")
        wait(0.1)

    local model = bin.Monster:clone() 
    me.Character.Humanoid.Name = "Me"
    model.Parent = me.Character
    model:MakeJoints()
    model.Gemini.Torso.CFrame = me.Character.Torso.CFrame * CFrame.new(9,0,0)
    model.Gemini.Follow.Disabled = false

    LeftShoulder = model.Gemini.Torso["Left Shoulder"]
    LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.1,0,0)
    wait(0.1)
    LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.2,0,0)
    wait(0.1)
    LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.3,0,0)
    wait(0.1)
    LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.4,0,0)
    wait(0.1)
    LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.5,0,0)
    wait(0.1)



    MagicSym = Instance.new("Part")
    MagicSym.Parent = me.Character.Torso
    MagicSym.Anchored = true
    MagicSym.CanCollide = false
    MagicSym.formFactor = "Symmetric"
    MagicSym.BrickColor = BrickColor.new("New Yeller")
    MagicSym.Transparency = 1
    MagicSym.Name = "MagicSym"
    MagicSym.Size = Vector3.new(30, 1, 30)
    MagicSym.TopSurface = "Smooth"
    MagicSym.CFrame = me.Character.Torso.CFrame*CFrame.new(4.5,-3, 0)

d = Instance.new("Decal")
d.Name = "Circle"
d.Parent = MagicSym
d.Face = "Top"
d.Texture = "http://www.roblox.com/asset/?id=214848393"



    for loop = 1, 200 do
    MagicSym.CFrame = MagicSym.CFrame *CFrame.Angles(0, 0.005, 0)
    wait(1/25)
    end





wait(3)
MagicSym:Remove()
    me.Character.Torso.Anchored = false
RightShoulder = me.Character.Torso["Right Shoulder"]
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.4,0,0)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.3,0,0)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.2,0,0)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.1,0,0)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0,0,0)
    RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.5,0,0)


    if me.Character:FindFirstChild("Monster")~= nil then    
    game:GetService("Chat"):Chat(me.Character.Head, "Thank you!")
    model:remove()
    me.Character.Me.Name = "Humanoid"
    else
    end
        if me.Character:FindFirstChild("Me")~= nil then
        me.Character.Me.Name = "Humanoid"
        else
    end
    wait()

    enabled = true

    mouse.Icon = "rbxasset://textures\\GunCursor.png"

end

function onSelected(mouse)
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end



bin.Selected:connect(onSelected)
end            




The problem is that it does not run. It used to be a MouseButton1click but I decided to make it a keydown. Right now nothing happens. Error:

17:41:13.070 - Players.Player1.Backpack.Urano.LocalScript:134: ')' expected (to close '(' at line 8) near '<eof>'

0
Maybe you should tell us what is wrong instead of asking what is wrong so we can fix what is wrong? 1waffle1 2908 — 9y
0
There are no "end)" If you're gonna make a event function, You need to have "end)" not "end" KenzaXI 166 — 9y

1 answer

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

Let's start with the error message. It gives you a clue on what's going on. In case if you didn't know, eof means end of file, or basically the end of the script.

So basically we're missing some ends! This would've been avoided if you tabbed your code correctly.

bin = script.Parent

me = script.Parent.Parent.Parent
--[[
    or
    local Player = game.Players.LocalPlayer
    local Character = Player.Character or Player.CharacterAdded:wait()
--]]

local enabled = true
local bin = script.Parent

bin.Selected:connect(function(mouse)
    mouse.KeyDown:connect(function(key)
        if key == "c" then
            if enabled == false then
                return
            end
            enabled = false
            me.Character.Torso.Anchored = true
            RightShoulder = me.Character.Torso["Right Shoulder"]
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.1,0,0)
            wait(0.1)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.2,0,0)
            wait(0.1)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.3,0,0)
            wait(0.1)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.4,0,0)
            wait(0.1)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(-0.5,0,0)
            wait(0.1)
            game:GetService("Chat"):Chat(me.Character.Head, "Survey the Heavens, Open the Heavens...")
            wait(0.5)
            game:GetService("Chat"):Chat(me.Character.Head, "Oh 88 Stars of the heaven...")
            wait(0.1)
            game:GetService("Chat"):Chat(me.Character.Head, "Shine!")
            wait(0.1)
            game:GetService("Chat"):Chat(me.Character.Head, "Urano Metria!")
            wait(0.1)
            local model = bin.Monster:clone() 
            me.Character.Humanoid.Name = "Me"
            model.Parent = me.Character
            model:MakeJoints()
            model.Gemini.Torso.CFrame = me.Character.Torso.CFrame * CFrame.new(9,0,0)
            model.Gemini.Follow.Disabled = false
            LeftShoulder = model.Gemini.Torso["Left Shoulder"]
            LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.1,0,0)
            wait(0.1)
            LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.2,0,0)
            wait(0.1)
            LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.3,0,0)
            wait(0.1)
            LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.4,0,0)
            wait(0.1)
            LeftShoulder.C0 = LeftShoulder.C0*CFrame.Angles(0.5,0,0)
            wait(0.1)
            MagicSym = Instance.new("Part")
            MagicSym.Parent = me.Character.Torso
            MagicSym.Anchored = true
            MagicSym.CanCollide = false
            MagicSym.formFactor = "Symmetric"
            MagicSym.BrickColor = BrickColor.new("New Yeller")
            MagicSym.Transparency = 1
            MagicSym.Name = "MagicSym"
            MagicSym.Size = Vector3.new(30, 1, 30)
            MagicSym.TopSurface = "Smooth"
            MagicSym.CFrame = me.Character.Torso.CFrame*CFrame.new(4.5,-3, 0)
            d = Instance.new("Decal")
            d.Name = "Circle"
            d.Parent = MagicSym
            d.Face = "Top"
            d.Texture = "http://www.roblox.com/asset/?id=214848393"
            for loop = 1, 200 do
                MagicSym.CFrame = MagicSym.CFrame *CFrame.Angles(0, 0.005, 0)
                wait(1/25)
            end
            wait(3)
            MagicSym:Destroy() -- Don't use :Remove()!
            me.Character.Torso.Anchored = false
            RightShoulder = me.Character.Torso["Right Shoulder"]
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.4,0,0)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.3,0,0)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.2,0,0)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.1,0,0)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0,0,0)
            RightShoulder.C0 = RightShoulder.C0*CFrame.Angles(0.5,0,0)
            if me.Character:FindFirstChild("Monster")~= nil then    
                game:GetService("Chat"):Chat(me.Character.Head, "Thank you!")
                model:Destroy() -- Don't use :Remove()!
                me.Character.Me.Name = "Humanoid"
            else
            end
            if me.Character:FindFirstChild("Me")~= nil then
                me.Character.Me.Name = "Humanoid"
            else
            end
            wait()

            enabled = true
            mouse.Icon = "rbxasset://textures\\GunCursor.png"
        end
-- We're missing 2 ends here.

function onSelected(mouse)
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
    -- There's no such function as "onButton1Down()"
end

bin.Selected:connect(onSelected)
end -- This is not needed. You're not really closing anything.

If you want to further improve your script, please look into...

Local variables

:Destroy() method

UserInputService

0
Thx Relampago1204 73 — 9y
Ad

Answer this question