Alend43
|
  |
| Joined: 13 Nov 2013 |
| Total Posts: 451 |
|
|
| 02 Aug 2017 09:39 PM |
local Player = game.Players.LocalPlayer local Button = Player.PlayerGui.TestingGui.TextButton local aPart = game.Workspace.aPart
Button.MouseButton1Click:connect(function() Instance.new("Part").Parent = game.Workspace game.Workspace.Part.Name = "some part" game.Workspace.Part.Position = aPart - 2,2,3 game.Workspace.Part.BrickColor = Color3.new(255,0,0) game.Workspace.Part.Size = Vector3.new(1,1,1) end)
What the actual hell is wrong with this...
error is: attempt to index local 'Player' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2017 09:41 PM |
How would the server have a local player?
|
|
|
| Report Abuse |
|
|
Buddy6445
|
  |
| Joined: 01 Nov 2008 |
| Total Posts: 137 |
|
|
| 02 Aug 2017 09:41 PM |
| Is this in a Script or a LocalScript? If it's in a Script, it needs to be in a LocalScript. |
|
|
| Report Abuse |
|
|
| |
|
Alend43
|
  |
| Joined: 13 Nov 2013 |
| Total Posts: 451 |
|
|
| 02 Aug 2017 09:43 PM |
| It was in a Script at first, I switched to a local script and it still didnt work, just no error, so I thought If I kept it in a script and showing you the error would be better. Ive already tried it in a local script is what Im saying. |
|
|
| Report Abuse |
|
|
Alend43
|
  |
| Joined: 13 Nov 2013 |
| Total Posts: 451 |
|
| |
|
Alend43
|
  |
| Joined: 13 Nov 2013 |
| Total Posts: 451 |
|
|
| 02 Aug 2017 09:53 PM |
bummmmmmmp
seriously guys I havent got a single answer or tip or a bit of help |
|
|
| Report Abuse |
|
|
Alend43
|
  |
| Joined: 13 Nov 2013 |
| Total Posts: 451 |
|
|
| 02 Aug 2017 10:00 PM |
| bououououoompmpmpmpmpmp this is seriously ####### me out |
|
|
| Report Abuse |
|
|
Alend43
|
  |
| Joined: 13 Nov 2013 |
| Total Posts: 451 |
|
|
| 02 Aug 2017 10:03 PM |
booomp
Im starting to think I will never get an answer of any kind :( |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 02 Aug 2017 10:04 PM |
so here is first a tip
one
if you are dealing with screenguis
or something called the local player, that needs to be in a localscript, and probably in either starterplayerscripts or the startergui
two
if this script is just for a single gui, then it should be under that gui in the explorer
so that you can do
local gui = script.Parent
and not have to find it in the player's PlayerGui
three
make a variable for the part you are creating inside your function
i.e
local part = Instance.new("Part")
four, here is your corrected script and why, compare it to your code and read my notes
--
--place this LOCAL SCRIPT directly inside the gui that you want to be clicked
local Button = script.Parent local aPart = game.Workspace.aPart
Button.MouseButton1Click:Connect(function() local part = Instance.new("Part") --make a variable part.Name = "some part" part.Position = aPart.Position - Vector3.new(2,2,3) --first you have to get "aPart"s position, not just the part, and to subtract from the position you need to subtract a Vector3 value. part.Color = Color3.fromRGB(255,0,0) --[[ Color3 is not how you change the BrickColor property, it is how you change the Color property. Second, if you are trying to use standard RGB(red, green blue), which I am guessing you are based off of having a 255, you have to do Color.fromRGB(r, g, b) --]] part.Size = Vector3.new(1,1,1) part.Parent = game.Workspace --parenting it to the Workspace should be the last step end) |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 02 Aug 2017 10:06 PM |
also you have been reported for spamming
bumping this thread that many times just when I was typing that, I could of just not gave the reply at all because you are impatient and entitled.
Regardless of the Forum merge, in one minute, or even a few minutes, your post won't go off the first page of Scripters, so wait at least an hour, and if it isn't on the front page, then you can bump it once. |
|
|
| Report Abuse |
|
|