of     1   

dukeispie
#183067421Saturday, February 06, 2016 1:40 AM GMT

I was trying to create a shop featuring a camera that would rotate around the object the player was buying, but came across this: local dBounce = false function onclick(player) if dBounce == false then local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" dBounce = true end if dBounce == true then local cam = game.Workspace.CurrentCamera cam.CameraSubject = player.Character.Humanoid cam.CameraType = "Custom" dBounce = false end return end script.Parent.MouseButton1Click:connect(onclick) The Output it Gave me: "Players.Player.PlayerGui.Shop.TextButton.Script:11: attempt to index local 'player' (a nil value)" Any help? Thanks!
llaserx
#183067531Saturday, February 06, 2016 1:42 AM GMT

dukeispie
#183067944Saturday, February 06, 2016 1:48 AM GMT

Changed the script to local player, local dBounce = false function onclick() if dBounce == false then local Player = game.Players.LocalPlayer local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" dBounce = true end if dBounce == true then local Player = game.Players.LocalPlayer local cam = game.Workspace.CurrentCamera cam.CameraSubject = Player.Character.Humanoid cam.CameraType = "Custom" dBounce = false end return end script.Parent.MouseButton1Click:connect(onclick) Doesn't give me any output but doesn't work.
dukeispie
#183068418Saturday, February 06, 2016 1:56 AM GMT

bump
llaserx
#183068432Saturday, February 06, 2016 1:56 AM GMT

try local dBounce = false function onclick(player) local plr = game.Players.LocalPlayer if dBounce == false then local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" dBounce = true end if dBounce == true then local cam = game.Workspace.CurrentCamera cam.CameraSubject = plr.Character.Humanoid cam.CameraType = "Custom" dBounce = false end return end script.Parent.MouseButton1Click:connect(onclick) http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$341 Tx536 (づ ゚ ³ ゚)づ
dukeispie
#183068578Saturday, February 06, 2016 1:58 AM GMT

Still doesn't work, it seems as if you just renamed the variable which is no help. Anyone else?
llaserx
#183068625Saturday, February 06, 2016 1:59 AM GMT

Lord_Narwhal
#183068638Saturday, February 06, 2016 1:59 AM GMT

it's not working because it's not a localscript #Code print("Narwhals are our future")
dukeispie
#183068693Saturday, February 06, 2016 2:00 AM GMT

When I tried making it a global it still didn't work.
Lord_Narwhal
#183068946Saturday, February 06, 2016 2:04 AM GMT

this is my best try debounce = false local p = game.Players.LocalPlayer repeat wait() until p.Character ~=nil local c = p.Character local h = c:WaitForChild("Humanoid") script.Parent.MouseButton1Down:connect(function() if debounce == false then local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" debounce = true if debounce == true then local cam = game.Workspace.CurrentCamera cam.CameraSubject = h cam.CameraType = "Custom" wait(2) debounce = false end end end) #Code print("Narwhals are our future")
dukeispie
#183069509Saturday, February 06, 2016 2:12 AM GMT

Doesn't work.... AHHH WHAT'S WRONG?!?!?!
Lord_Narwhal
#183069749Saturday, February 06, 2016 2:16 AM GMT

my script isn't wrong must be your hierarchy and whatnot #Code print("Narwhals are our future")
dukeispie
#183069834Saturday, February 06, 2016 2:18 AM GMT

What do you mean? It doesn't come up with any output and doesn't work. If I try this local dBounce = false script.Parent.MouseButton1Click:connect(function(player) if dBounce == false then local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" dBounce = true end if dBounce == true then local cam = game.Workspace.CurrentCamera cam.CameraSubject = player.Character.Humanoid cam.CameraType = "Custom" dBounce = false end end) on a Global that isn't wrong, but doesn't define player for some reason.
dukeispie
#183071056Saturday, February 06, 2016 2:36 AM GMT

bump
nitromonk
#183071140Saturday, February 06, 2016 2:38 AM GMT

Can someone teach me scripting??? Owner of doge inc.
dukeispie
#183119349Saturday, February 06, 2016 11:24 PM GMT

bump
wonderful72pike
#183119563Saturday, February 06, 2016 11:28 PM GMT

local dBounce = false script.Parent.MouseButton1Click:connect(function(player) if dBounce == false then local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" dBounce = true end if dBounce == true then local cam = game.Workspace.CurrentCamera cam.CameraSubject = player.Character.Humanoid cam.CameraType = "Custom" dBounce = false end end) This will not define the player because MouseButton1Click does not pass in the player as an argument. First you need to remove the "player" from inside "function()" and put it at the top, under dBounce: local player = game.Players.LocalPlayer Then you need to make sure the thing you want it to focus on is called "ThingyOne" and it is in Workspace. After that, you need to put this inside of a TextButton that is inside of a ScreenGui that is inside of StarterGui.
dukeispie
#183119726Saturday, February 06, 2016 11:31 PM GMT

You have NO IDEA how many times people have told me that, when I do local player = game.Players.LocalPlayer inside a local script it does not work for some reason.
wonderful72pike
#183119740Saturday, February 06, 2016 11:31 PM GMT

Oh also, one more thing that literally makes the ENTIRE THING work: your script keeps reseting itself. Notice that at the end of the first condition it sets dBounce to true. Then the next condition checks if it's true and sets it back to false again. Your script never changes, it IMMEDIATELY resets itself. Here is the full fixed version I just got to work in Studio: local dBounce = false local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() if dBounce == false then print("False") local cam = game.Workspace.CurrentCamera cam.CameraSubject = game.Workspace.ThingyOne cam.CameraType = "Custom" dBounce = true return end if dBounce == true then print("True") local cam = game.Workspace.CurrentCamera cam.CameraSubject = player.Character.Humanoid cam.CameraType = "Custom" dBounce = false return end end)
LegendaryAccount
#183119934Saturday, February 06, 2016 11:34 PM GMT

holy MouseButton1Click does not return anything. function getLocalPlayer() c = script repeat c = c.Parent until c:IsA("Player") return c end player = getLocalPlayer
TimeTicks
#183121301Sunday, February 07, 2016 12:00 AM GMT

MouseButton1Click doesnt return anything. MouseButton1Click:connect(function() print(game.Players.LocalPlayer) end)

    of     1