Hello. I have a problem with my shop Gui.
local price = script.Parent.Price local price2 = script.Parent.Parent.Info.Price local price3 = script.Parent.Parent.Info.ItemPrice local name = script.Parent.ItemName local name2 = script.Parent.Parent.Info.ItemName local name3 = script.Parent.Parent.Info.ItemName1 local image = script.Parent.ItemImage local image2 = script.Parent.Parent.Info.ItemImage script.Parent.MouseButton1Click:Connect(function(player) print("Hey") price2.Value = price.Value price3.Text = price.Value name2.Text = name.Value name3.Value = name.Value image2.Image = image.Value if player.PlayerTools:FindFirstChild(player.PlayerGui.Shop.ShopFrame.Info.ItemName.Text) then print("Hola") player.PlayerGui.Shop.ShopFrame.Info.Buy.Text = "Equip" end end)
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
local player = game:GetService("Players").LocalPlayer
Let me know if this works or not. Cheers
Since you want it to be a serverside script,
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
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)