I am trying to make a Server Control Panel. So basically, I've tried this already and it succeeded with my other string values, but when it came to the string I'm asking about, there's a problem. Here is my server script to read. (Ignore the objects except for the "kick reason" value.)
game.ReplicatedStorage.Kick.OnServerEvent:Connect(function(plr,accusedplayer) print("Searching for player...") local reporter = game.StarterGui.StringValues.KickValues.Reporter.Value local reason = game.StarterGui.StringValues.KickValues.KickReason.Value print(reporter.." is the reporting player.") print(accusedplayer.." is the accused player.") print("Reason: "..reason) --Only prints "Enter Reason Here" somehow or prints nothing... game.Players[accusedplayer]:Kick(reporter.." kicked you out. Reason: "..reason) --The player viewing the "kick" notification will only see "Enter Reason Here" or no words after "Reason:" print("Player has been found.") end)
Now the problem is, I can't find out why the values aren't equal, like let's say that the AccusedPlayer value will change when the "KickReasonBox" is modified in gameplay. Let's go back to the previous scriptwriting and let me tell you that when the script prints the value of the AccusedPlayer, it works. I can't say the same for the KickReason value. Here's another useful script to investigate.
function kickplayer() local accusedplayer = game.StarterGui.StringValues.KickValues.AccusedPlayer game.ReplicatedStorage.Kick:FireServer(accusedplayer.Value) end script.Parent.MouseButton1Click:Connect(kickplayer) script.Parent.Parent.KickReasonBox.Changed:Connect(function() --The problem here game.StarterGui.StringValues.KickValues.KickReason.Value = script.Parent.Parent.KickReasonBox.Text --The value changes just fine, but the script prints it improperly. end) script.Parent.Parent.Changed:Connect(function() game.StarterGui.StringValues.KickValues.AccusedPlayer.Value = script.Parent.Parent.Text end)
What I found out was that when LocalScripts modify stuff, the local player will only find out that it changed. For the rest of the server, the stuff is untouched. Using a Script and a RemoteEvent would be very useful.