There is a TextButton
inside a ScreenGui
.
The TextButton
is the one I am using MouseButton1Click
.
--This is a script inside the 'TextButton' local function mouseClicked(player) game:GetService("ReplicatedStorage").ShopBuy:FireClient(player) end script.Parent.MouseButton1Click:Connect(mouseClicked)
--This is a LocalScript inside the 'ScreenGui' in StarterGui local remote = game:GetService("ReplicatedStorage"):WaitForChild("ShopBuy") remote.OnClientEvent:Connect(function() script.Parent.Open.Value = true end)
--This is a LocalScript inside the 'ScreenGui' in StarterGui. This Script will open the Gui with TweenPosition. if script.Parent.Open.Value == true then script.Parent.PromptPurchase:TweenPosition(UDim2.new(0.5,-225,0.5,-150),"Out","Quint",0.1,"true") end
Note that 'Open' is a BoolValue in the Gui. It will just notify if the Gui should open.
Okay. There is a problem from now.
--Output : FireClient: player argument must be a Player object
There was a error so I looked up on the Roblox Wiki but still the red output won't go away.
Can anybody tell me why doesn't this script(or localscript) doesn't work and can give a fix if necessary?
Thanks for your support.
Because you said that you have this script in a TextButton, I assume that you are using a Local Script. If so, you can use LocalPlayer to get the player,
game:GetService("ReplicatedStorage").ShopBuy:FireClient(game.Players.LocalPlayer)