Text Button In Bilboard:
local Players = game:GetService('Players')
local button = script.Parent
local SellItemCheckRF = ReplicatedStorage.SellItemCheck
local proximityPrompt = workspace.Store.ProximityPrompt
button.MouseButton1Click:Connect(function()
ReplicatedStorage.LocalMainMenuDisable:FireServer()
local playerGUI = Players.LocalPlayer.PlayerGui
local retStatus = SellItemCheckRF:InvokeServer()
if not retStatus then
playerGUI.SellReplies.NoItemFound.Enabled = true
wait(2)
playerGUI.SellReplies.NoItemFound.Enabled = false
end
proximityPrompt.Enabled = true
end)
ServerInvokes:
local sellItemCheckRF = ReplicatedStorage.SellItemCheck
local LocalMainMenuDisable = ReplicatedStorage.LocalMainMenuDisable
local LocalProximityPromptTriger = ReplicatedStorage.LocalProximityPromptTriger
sellItemCheckRF.OnServerInvoke = function(player: Player)
local itemToSell = player.Character:FindFirstChildOfClass('Tool')
if itemToSell and itemToSell:GetAttribute('Value') then
if itemToSell.Name == 'Sword' and itemToSell:GetAttribute('Value') == 100 then
itemToSell:Destroy()
player.leaderstats.Coins.Value = 100
end
return true
else
return false
end
end
LocalMainMenuDisable.OnServerEvent:Connect(function(player)
player.PlayerGui.StoreConversation.Buy.Enabled = false
player.PlayerGui.StoreConversation.Info.Enabled = false
player.PlayerGui.StoreConversation.Sell.Enabled = false
player.PlayerGui.StoreConversation.Nevermind.Enabled = false
end)
I don't know what's causing this lag