Hello. I have a problem with my shop Gui.
01 | local price = script.Parent.Price |
02 | local price 2 = script.Parent.Parent.Info.Price |
03 | local price 3 = script.Parent.Parent.Info.ItemPrice |
04 | local name = script.Parent.ItemName |
05 | local name 2 = script.Parent.Parent.Info.ItemName |
06 | local name 3 = script.Parent.Parent.Info.ItemName 1 |
07 | local image = script.Parent.ItemImage |
08 | local image 2 = script.Parent.Parent.Info.ItemImage |
09 |
10 | script.Parent.MouseButton 1 Click:Connect( function (player) |
11 | print ( "Hey" ) |
12 |
13 | price 2. Value = price.Value |
14 | price 3. Text = price.Value |
15 | name 2. Text = name.Value |
Btw I have a folder named PlayerTools
I'm pretty sure this is in a LocalScript (otherwise it wouldn't work), You're trying to get a player
parameter but MouseButton1Click
won't give you that (MouseClick
from the click detector does that) because you can just get the local player since this is a LocalScript, add this on top of your function
1 | local player = game:GetService( "Players" ).LocalPlayer |
Let me know if this works or not. Cheers
Since you want it to be a serverside script,
1 | game.Players.LocalPlayer |
is not going to work.
I would just parent until it reaches the player (the player is a child of game.Players)
For example, there is a gui, a frame, a script, and a textbutton. To get the player, I would do
1 | script.Parent.Parent.Parent.Parent.Parent |
To explain it more:
script - The script (Its Parent is Text Button)
Parent - Text Button (Its Parent is Frame)
Parent - Frame (Its Parent is Gui)
Parent - Gui (Its Parent is PlayerGui)
Parent - PlayerGui which is where all the guis are stored (for each player) (Its Parent is the Player from game.Players)