I written the Events
table poorly.
local Events = {
["ForHire"] = ReplicatedStorage:WaitForChild("ForHire"),
["Hiring"] = ReplicatedStorage:WaitForChild("Hiring"),
["Hosting"] = ReplicatedStorage:WaitForChild("Hosting"),
["Public"] = ReplicatedStorage:WaitForChild("Public"),
}
Instead, use String values, and when getting the event, use Events[question.Name]
.
Are the names of the Questions the same?
Im not sure what you meanâŚ
The names are:
ForHire
Hiring
Posting
Public
Ima go to bed for now:
I should be back here by about 3:00 - 3:15 EST Tommorow.
I shouldâve stated specifically.
When you loop over each question, they appear to only be editing one result in the bottom left corner. This can happen if all the questionâs names are the same. Is each question different?
^ Stats
^ Questions
Maybe instead of using an Events
table to store the RemoteEventsâ locations, we could instead directly find the RemoteEvent using the questionâs name and check if itâs there.
local RemoteEvent = ReplicatedStorage:FindFirstChild(question.Name)
Exploiters are able to change the name of the question and make the script execute a different RemoteEvent, so it might be safer to place the 4 RemoteEvents that are being created in a separate folder.
For measures of debugging, try adding a print statement that states the name of the question, the name of the RemoteEvent it got, and the StatText
.
print(`'{question.Name}' is connected to this event called '{RemoteEvent.Name}' and this Stat Text '{statText.Name}'`)
So the leaderstats are reflecting the correct behavior. But the gui is not?
Also you should change
local key = player.UserId
to
local key = tostring(player.UserId)
Itâs expecting a string:
Change it for both load and save.
If the case is that itâs just the gui, then connect to the .Changed event for each leaderstat value and change the relative guis color.
Alright yall, Ive made the decision to stop trying to fix this, because I donât want to simply waste all of you guyâs time. So I changed the format from this:
To This, for better functionality and easier fixing.
But of course, I am still a UI Designer and solely that. So if you could help me make this work, Iâd be very appreciative.
WHAT I NEED DONE:
If the value of each of them equals No then it should say NO and have a text color of
(255, 67, 67) and if it equals Yes then it should say YES and have a text color of
(85, 255, 127)
PICTURES WITH EXPLINATIONS:
Frames: The name is just the first letter of each word in each question
UI Corner and UI Stroke: You know this one
ChangeButton: The Button in the text that says âChangeâ
CurrentlyAnswer: The text under the ChangeButton that has color and says either: YES or NO and is in there to not have to use richtext
CurrentlyLabel: This doesnât really matter, just the label that says âCurrentlyâ
SettingDescription: The questions written out
IF YOU HAVE ANY FURTHER QUESTIONS OR NEED ANY OTHER INFORMATION FROM ME, SIMPLY ASK AND I WILL PROVIDE!
If the leaderstat is working it is simply a matter of syncing the gui. You still didnât answer my question.
To Start, I have made this script here⌠Still working on making it save thoughâŚ
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Stat1 = leaderstats:WaitForChild("ForHire")
local Stat2 = leaderstats:WaitForChild("Hiring")
local Stat3 = leaderstats:WaitForChild("Posting")
local Stat4 = leaderstats:WaitForChild("Public")
local RemoteEvent1 = ReplicatedStorage:WaitForChild("ForHire")
local RemoteEvent2 = ReplicatedStorage:WaitForChild("Hiring")
local RemoteEvent3 = ReplicatedStorage:WaitForChild("Posting")
local RemoteEvent4 = ReplicatedStorage:WaitForChild("Public")
script.Parent.DYWOTHYTemplate.ChangeButton.MouseButton1Click:Connect(function()
task.wait(0.5)
if leaderstats.ForHire.Value == "No" then
leaderstats.ForHire.Value = "Yes"
else
leaderstats.ForHire.Value = "No"
end
script.Parent.DYWOTHYTemplate.CurrentlyAnswer.Text = Stat1.Value
if Stat1.Value == "No" then
script.Parent.DYWOTHYTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(255, 67, 67)
script.Parent.DYWOTHYTemplate.CurrentlyAnswer.Text = "NO"
RemoteEvent1:FireServer(false)
end
if Stat1.Value == "Yes" then
script.Parent.DYWOTHYTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(85, 255, 167)
script.Parent.DYWOTHYTemplate.CurrentlyAnswer.Text = "YES"
RemoteEvent1:FireServer(true)
end
Stat1.Changed:Connect(function()
script.Parent.DYWOTHYTemplate.CurrentlyAnswer.Text = Stat1.Value
end)
end)
script.Parent.DYWTBPTemplate.ChangeButton.MouseButton1Click:Connect(function()
task.wait(0.5)
if leaderstats.Public.Value == "No" then
leaderstats.Public.Value = "Yes"
else
leaderstats.Public.Value = "No"
end
script.Parent.DYWTBPTemplate.CurrentlyAnswer.Text = Stat4.Value
if Stat4.Value == "No" then
script.Parent.DYWTBPTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(255, 67, 67)
script.Parent.DYWTBPTemplate.CurrentlyAnswer.Text = "NO"
RemoteEvent4:FireServer(false)
end
if Stat4.Value == "Yes" then
script.Parent.DYWTBPTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(85, 255, 167)
script.Parent.DYWTBPTemplate.CurrentlyAnswer.Text = "YES"
RemoteEvent4:FireServer(true)
end
Stat4.Changed:Connect(function()
script.Parent.DYWTBPTemplate.CurrentlyAnswer.Text = Stat4.Value
end)
end)
script.Parent.DYWTHOTemplate.ChangeButton.MouseButton1Click:Connect(function()
task.wait(0.5)
if leaderstats.Hiring.Value == "No" then
leaderstats.Hiring.Value = "Yes"
else
leaderstats.Hiring.Value = "No"
end
script.Parent.DYWTHOTemplate.CurrentlyAnswer.Text = Stat2.Value
if Stat2.Value == "No" then
script.Parent.DYWTHOTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(255, 67, 67)
script.Parent.DYWTHOTemplate.CurrentlyAnswer.Text = "NO"
RemoteEvent2:FireServer(false)
end
if Stat2.Value == "Yes" then
script.Parent.DYWTHOTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(85, 255, 167)
script.Parent.DYWTHOTemplate.CurrentlyAnswer.Text = "YES"
RemoteEvent2:FireServer(true)
end
Stat2.Changed:Connect(function()
script.Parent.DYWTHOTemplate.CurrentlyAnswer.Text = Stat2.Value
end)
end)
script.Parent.DYWTPTemplate.ChangeButton.MouseButton1Click:Connect(function()
task.wait(0.5)
if leaderstats.Posting.Value == "No" then
leaderstats.Posting.Value = "Yes"
else
leaderstats.Posting.Value = "No"
end
script.Parent.DYWTPTemplate.CurrentlyAnswer.Text = Stat3.Value
if Stat3.Value == "No" then
script.Parent.DYWTPTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(255, 67, 67)
script.Parent.DYWTPTemplate.CurrentlyAnswer.Text = "NO"
RemoteEvent3:FireServer(false)
end
if Stat3.Value == "Yes" then
script.Parent.DYWTPTemplate.CurrentlyAnswer.TextColor3 = Color3.fromRGB(85, 255, 167)
script.Parent.DYWTPTemplate.CurrentlyAnswer.Text = "YES"
RemoteEvent3:FireServer(true)
end
Stat3.Changed:Connect(function()
script.Parent.DYWTPTemplate.CurrentlyAnswer.Text = Stat3.Value
end)
end)
You know what, its okay. I dont need this.
THANK YOU ALL FOR THE HELP!
char limit
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.