Hello. I’m trying to let the user be able to try on clothes on the serverside by pressing buttons of the GUI. When I press on the GUI nothing prints except for “duplicated”.
Here is the server script that fires the event:
local ProximityPromptService = game:GetService("ProximityPromptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local remoteEvent = ReplicatedStorage.Click
local shirtid = script.Parent.Config.shirtid
local shirtassetid = script.Parent.Config.shirtassetid
local pantsid = script.Parent.Config.pantsid
local pantsassetid = script.Parent.Config.pantsassetid
game.Players.PlayerAdded:Connect(function(Player)
script.Parent.ProximityPrompt.PromptButtonHoldEnded:Connect(function()
local count = 0
for i,v in pairs(Player.PlayerGui:GetChildren()) do
if v.Name == "TryOn" then
count = count + 1
end
if count > 2 then
Player.PlayerGui.TryOn:Destroy()
end
end
print(count)
remoteEvent:FireClient(Player, shirtid.Value, shirtassetid.Value, pantsid.Value, pantsassetid.Value)
print("fired")
end)
end)
And here is the GUI local script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Click")
local Player = game.Players.LocalPlayer
local function onNotifyPlayer(shirtid, shirtassetid, pantsid, pantsassetid)
local gui = Player.PlayerGui.GUI:Clone()
gui.Name = "TryOn"
gui.Parent = Player.PlayerGui
gui.Frame.Visible = true
print("Duplicated")
--purchase pants
script.Parent.PurchasePants.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptPurchase(Player, pantsid)
print("purchase pants clicked")
end)
-- purchase shirt
script.Parent.PurchaseShirt.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptPurchase(Player, shirtid)
print("purchase shirt clicked")
end)
-- try on shirt
script.Parent.TryOnShirt.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TryOnShirt:FireServer(shirtassetid)
print("try shirt clicked")
end)
-- try on pants
script.Parent.TryOnPants.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TryOnPants:FireServer(pantsassetid)
print("try pants clicked")
end)
end
remoteEvent.OnClientEvent:Connect(onNotifyPlayer)
The close button is a local script inside the button and it works just fine, so I’m not sure why it doesn’t work inside this local script.
Here is the GUI:
And inside game settings and security I turned on HTTP requests as well.
All help is appreciated!