I am trying to make a ban appeal system, When the player submits the ban appeal, It fires a RemoteEvent and the remote event saves to the DataStore with the BoolValues value being true, When the player joins, if the BoolValue is set to true, It fires a different RemoteEvent to the client side, showing a different UI, However it doesn’t work and I was wondering if somebody count help me.
Server Script:
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("BanAppeals")
Players.PlayerAdded:Connect(function(Player)
local BoolValue = Instance.new("BoolValue")
BoolValue.Name = "HasAppealPending"
BoolValue.Parent = Player
end)
game.ReplicatedStorage.SendAppeal.OnServerEvent:Connect(function(Player)
local BoolValue = Player:FindFirstChild("HasAppealPending")
if BoolValue and not BoolValue.Value then
BoolValue.Value = true
DataStore:SetAsync(Player.UserId, true)
game.ReplicatedStorage.AppealPending:FireClient(Player)
end
end)
LocalScript:
Submitting the appeal
local function SubmitAppeal()
local LocalPlayer = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.SendAppeal:FireServer(Answer1.Text, Answer2.Text, Answer3.Text, Answer4.Text)
LocalPlayer:WaitForChild("HasAppealPending").Value = true
LocalPlayer:Kick("Appeal Successfully Sent!")
end
Form.Submit.MouseButton1Click:Connect(SubmitAppeal)
What happens when the Client Event is fired:
local function AppealPending()
Home.Visible = false
Pending.Visible = true
end
game.ReplicatedStorage.AppealPending.OnClientEvent:Connect(function()
AppealPending()
end)