Hey everyone,
I have a frame with a textlabel inside of it, in ReplicatedStorage. When the player orders something, the frame goes into the UI. For some reason, whenever I press the textbutton after it got parented to the PlayerGui, I keep getting the title as an error. Here are all the scripts:
Also, I tried printing the script.Parent.Parent, it just prints “nil”
Script inside of TextButton in ReplicatedStorage:
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.FinishOrder:FireServer(script.Parent.Parent)
end)
Script inside ServerScriptService:
finishOrder.OnServerEvent:Connect(function(player, uiElement)
currentOrderAmount.Value -= 1
print(uiElement)
finishOrder:FireAllClients(uiElement)
end)
Script inside of StarterGui
finishOrder.OnClientEvent:Connect(function(uiElement)
uiElement:Destroy()
end)