Basically, I'm trying to make an Application Center that automatically ranks the player. I have all of the gui scripts finished, and it fires the client, but for some reason its not working. I've tried to figure out the problem, but I cant. I know the problem is coming from the RemoveEvent not firing, and the Server script is fine.
LocalScript That Ranks Player:
local HttpService = game:GetService("HttpService") local Server = require(script.Server) local ReplicatedStorage = game:GetService("ReplicatedStorage") local RankPlayer = game.ReplicatedStorage.RankPlayer RankPlayer.OnClientEvent:Connect(function() Server.SetRank(5947903, game.Players.LocalPlayer.UserId, 3) end)
Ending Script To Fire Client:
while true do if script.Parent.Parent.Right.Value < 8 then script.Parent.Text = "Sorry, you did not pass. Please review the questions you got wrong and try again." elseif script.Parent.Parent.Right.Value >= 8 then script.Parent.Text = "Congratulations, you passed! You have been ranked: [LR] Officer." game.ReplicatedStorage.RankPlayer:FireAllClients() end wait() end
Scirpt that changes Selected Value:
script.Parent.MouseButton1Click:Connect(function() local current = script.Parent.Parent.Selected.Value if current == "None" then script.Parent.Text = "X" script.Parent.Parent.Selected.Value = "A" elseif current == "A" then local switch = current.."B" script.Parent.Parent:FindFirstChild(switch).Text = "" script.Parent.Text = "X" script.Parent.Parent.Selected.Value = "A" end end)
Determines If Right Or Wrong
script.Parent.Parent.Parent.Submit.END.MouseButton1Click:Connect(function() local q = script.Parent.Parent.Parent.Q1.Selected.Value local a = script.Parent.Parent.Parent.Q1.Right.Value if a == q then script.Parent.Text = " ?" script.Parent.Parent.Right.Value = script.Parent.Parent.Right.Value + 1 else script.Parent.Text = "X" end end)
If you can help me, thank you so much! This problem has been so annoying, and I've tried fixing it for about a week now with no success.
sometimes the function does not load immediatly
try a anonymous function
local HttpService = game:GetService("HttpService") local Server = require(script.Server) local ReplicatedStorage = game:GetService("ReplicatedStorage") local RankPlayer = game.ReplicatedStorage.RankPlayer RankPlayer.OnClientEvent:Connect(function() Server.SetRank(5947903, player.UserId, 3) end)
One of the main issues I see regarding this is the fact that the FireClient() method is empty.
In order to use FireClient(), one needs to have the player in the first parameter of the method, since you don't know which client you're trying to send the message to. If one needs to fire to all the clients, then one can simply do FireAllClients() to trigger the event for every single client.