generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How would I access the camera via plugin?

Previous Thread :: Next Thread 
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
26 Nov 2011 01:35 PM
Title. I am making a plugin that lets you create a regen button easily and I want the camera to look at the button once the player creates it. How would I do this?

#don't judge me or my squid
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
26 Nov 2011 01:44 PM
bump.

#don't judge me or my squid
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
26 Nov 2011 02:02 PM
bump

#don't judge me or my squid
Report Abuse
ReactorINC is not online. ReactorINC
Joined: 24 Nov 2011
Total Posts: 84
26 Nov 2011 02:36 PM
workspace.CurrentCamera.CameraSubject = game.Workspace.Part
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
26 Nov 2011 02:39 PM
@reac

I thought that was only accessible through localscript?

#don't judge me or my squid
Report Abuse
ReactorINC is not online. ReactorINC
Joined: 24 Nov 2011
Total Posts: 84
26 Nov 2011 02:41 PM
Plugins are local, it should work.
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
26 Nov 2011 02:52 PM
Ok well the script gives me this error:

"regen_button_plugin.lua:129: 'then' expected near '_regen'"

And here's my script (line is marked);


----------

    ----------------
    --plugin setup--
    ----------------
    
    plugin = PluginManager():CreatePlugin()
    toolbar = plugin:CreateToolbar("Pompey's Plugins")
    button = toolbar:CreateButton("", "Make a regen button for the model selected with your custom settings.", "button.png")
    
    -------------
    --variables--
    -------------
    
    local def_color = BrickColor.new("Bright violet")
    local def_waitTime = 3
    local def_deletesModel = false
    local on = false
    local loaded = false
    local cam = game.Workspace.CurrentCamera
    local del
    local checkmg = "http://www.roblox.com/asset/?id=66539845"
    
    -------------
    --GUI setup--
    -------------
    
    gui = Instance.new("ScreenGui", game:service("CoreGui"))
    gui.Name = "Regen Button Proprties"
    
    local frame = Instance.new("Frame", gui)
    
    reg_but = Instance.new("TextLabel", frame)
    reg_but.Name = "Regen Button"
    reg_but.Text = "Button Appearance"
    reg_but.Size = UDim2.new(0, 100, 0, 100)
    reg_but.TextWrap = true
    reg_but.BackgroundColor3 = BrickColor.new(def_color).Color
    
    col = Instance.new("TextBox",reg_but)
    col.Text = "ButtonColor"
    col.BackgroundColor3 = Color3.new(221/255, 221/255, 221/255)
    col.Size = UDim2.new(0, 100, 0, 30)
    col.Position = UDim2.new(0, 100, 0, 35)
    
    lbl = Instance.new("TextLabel", frame)
    lbl.Text = "Seconds until able to regen again"
    lbl.Name = "wait time label"
    lbl.Position = UDim2.new(0, 0, 0, 130)
    lbl.Size = UDim2.new(0, 200, 0, 0)
    lbl.BackgroundTransparency = 1
    lbl.FontSize = "Size10"
    
    wait = Instance.new("TextBox", lbl)
    wait.Text = def_waitTime
    wait.BorderSizePixel = 0
    wait.Size = UDim2.new(0, 30, 0, 30)
    wait.Position = UDim2.new(0, 80, 0, 10)
    
    create_but = Instance.new("TextButton", frame)
    create_but.Name = "create"
    create_but.BackgroundColor3 = Color3.new(0, 153/255, 0)
    create_but.BorderSizePixel = 0
    create_but.Position = UDim2.new(0, 0, 0, 200)
    create_but.Size = UDim2.new(0, 100, 0, 50)
    create_but.Text = "Create!"
    
    lbl2 = Instance.new("TextLabel", frame)
    lbl2.BorderSizePixel = 0
    lbl2.Text = "Button deletes original model"
    lbl2.FontSize = "Size12"
    lbl2.Size = UDim2.new(0, 210, 0, 0)
    lbl2.Position = UDim2.new(0, 0, 0, 200)
    
    check = Instance.new("ImageButton", lbl2)
    check.Size = UDim2.new(0, 30, 0, 30)
    check.Position = UDim2.new(0, 90, 0, 10)
    check.Name = "check"
    check.BorderSizepixel = 0
    
    -------------
    --functions--
    -------------
    
    button.Click:connect(function()
        if on then
            OFF()
        elseif loaded then
            ON()
        end
    end)
    
    function ON()
        plugin:Activate(true)
        button:SetActive(true)
        frame.Visible = true
    end
    
    function OFF()
        plugin:Activate(false)
        button:SetActive(false)
        frame.Visible = false
    end
    
    check.MouseButton1Down:connect(function()
        if check.Image == "" then
            check.Image = checkmg
            del = true
        elseif check.Image == checkmg then
            check.Image = ""
            del = false
        end
    end)
    
    -----------------
    --miscellaneous--
    -----------------
    
    coroutine.resume(coroutine.create(function()
    while wait() do
    reg_but.BackgroundColor3 = BrickColor.new(col.Text).Color
    end end))
    
    -----------------
    --main function--
    -----------------
    
    create_but.MouseButton1Down:connect(function()
        selected = game.Selection:Get()
        if selected == 1 then
            _regen = Instance.new("Part", workspace) --Line 129
            _regen.Name = "RegenButton"
            _regen.BrickColor = BrickColor.new(col.Text)
            _regen.Anchored = true
            _regen.TopSurface = 0
            _wait = Instance.new("NumberValue", _regen)
            _wait.Value = wait.Text
            _wait.Name = "WaitTime"
            demod = Instance.new("BoolValue", _regen)
            demod.Value = del
            demod.Name = "DeletesModel"
            modval = Instance.new("ObjectValue",_regen)
            modval.Value = selected
            modval.Name = "Model"
            
            reg_scr = Instance.new("Script", _regen)
            reg_scr.Source = [[
            local button = script.Parent
            local deletes = button.DeletesModel.Value
            local waitt = button.WaitTime.Value
            local mod = button.Model.Value
            local model = workspace:FindFirstChild(mod)
            local backup = model:clone()
            local db = false
            local orig = button.BrickColor
            
            button.Touched:connect(function(hit)
                if db the return end
                db = true
                button.BrickColor = BrickColor.new("Black")
                if hit.Parent:FindFirstChild("Humanoid") ~= nil then
                    new = backup:clone()
                    new.Parent = workspace
                    new:MakeJoints()
                    wait(waitt)
                    db = false
                    button.BrickColor = orig
                end
            end)]]
            cam.CameraSubject = _regen
            cam.CameraType = "Watch"
            wait()
            cam.CameraType = "Fixed"
        else print("Can only select one model at a time.")
        end
    end)
    
    ----------------------
    --successful load :D--
    ----------------------
    
    loaded = true
    print("Regen button creation plugin loaded.")


----------

Can anyone find the problem?

#don't judge me or my squid
Report Abuse
ReactorINC is not online. ReactorINC
Joined: 24 Nov 2011
Total Posts: 84
26 Nov 2011 02:57 PM
Hmm.

script.Source is locked even for plugins

and I don't know if it is a problem but change _regen, _wait etc to Kregen or Zregen, Zwait, I don't know if "_" will conflict or not.
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
26 Nov 2011 03:09 PM
Nevermind, I just realized I was not saving to the plugin file.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image