Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Either My Client Is Not Firing Or Not Detecting Its Been Fired?

Asked by 4 years ago
Edited 4 years ago

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.

0
Did u fireserver from client? JesseSong 3916 — 4y
0
Do ReplicatedStorage:FireServer() on the local script JesseSong 3916 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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)

0
If I do that, then I cannot reference the player's UserId Explorer2021 22 — 4y
0
o ok ProjectInfiniti 192 — 4y
0
Could I do Server.SetRank(5947903, game.Players.LocalPlayer.UserId, 3) ? Explorer2021 22 — 4y
0
Just tried it, still didn't work Explorer2021 22 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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.

0
I would try and further help by stating which variable you would need to put in FireClient, but in the scripts you've provided, it seems like there's not enough information present for me to determine this. animorphs30 300 — 4y
0
I hope this answer does assist you in attaining a solution however. animorphs30 300 — 4y
0
Hmm, what else would you need? Explorer2021 22 — 4y
0
I'd need to know how you get the player which triggers the change in the value, as that's the only way to determine which player to fire to. animorphs30 300 — 4y
View all comments (15 more)
0
Uhh I dont think I do Explorer2021 22 — 4y
0
Hmm, could you please explain the process behind how the script is supposed to work, I might be able to find out how you can detect the player. animorphs30 300 — 4y
0
Basically, the GUI I made changes a String Variables value, and at the end, it looks to see if the string values are above 8, and if it is, it fires the client. (Thats In a LocalScript) Then, in another script, when the client is fired, it uses the SetRank function inside of my Server Script, I can edit the post to show the server script if you would like. Explorer2021 22 — 4y
0
I see you've edited it to include the SetRank script. My bigger question is this, in the while loop, what is script.Parent.Parent, and more importantly, is this a local script or server script? animorphs30 300 — 4y
0
OnClientEvent doesn't have a Player parameter either. You should use game.Players.LocalPlayer in your LocalScript instead darkelementallord 686 — 4y
0
Script.Parent.Parent.Right is a String Value, and it changes for each question right, it's +1. Thats also in a LocalScript Explorer2021 22 — 4y
0
I just edited all scripts to match up with what I have currently from you guys' suggestions Explorer2021 22 — 4y
0
Well, if it's a string value, then wouldn't you need to run tonumber() on it to convert it into a number for comparisons? animorphs30 300 — 4y
0
My bad, it's a number value. Im going to go in and test if its changing or not Explorer2021 22 — 4y
0
Hmm it seems its not changing Explorer2021 22 — 4y
0
You'll need to post something regarding where the values are being changed then. animorphs30 300 — 4y
0
Ok I added it Explorer2021 22 — 4y
0
Uh, the code ya posted doesn't show Right changing, that or I'm assuming it changed to X??? animorphs30 300 — 4y
0
Uh, the code ya posted doesn't show Right changing, that or I'm assuming it changed to X??? animorphs30 300 — 4y
0
Its supposed to be changing Selected, and then ill add some more code to show when it determines if correct or not. Explorer2021 22 — 4y

Answer this question