You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
for it to print the strings and then do stuff from there -
What is the issue? Include screenshots / videos if possible!
FireClient doesnt send the strings? -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Havent found any, and i dont think i will since im a beginner at this stuff
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- OnServerScript
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")
ServerModule = require(ServerScriptService:WaitForChild("ServerModule"))
ActionTable = {"Action1", "Action2"}
DataSender1.OnServerEvent:Connect(function(Player, Data, Action)
if Action == "Action1" then
ServerModule.IncreaseLeaderStats(Player, Data, Action)
end
if Action == "Action2" then
ServerModule.CreatePlayersCode(Player, Data, Action)
end
if Action == "Action3" then
DataSender1:FireClient(Player,ActionTable)
end
end)
-- OnClientScript
Interface = script.Parent
Player = game:GetService("Players").LocalPlayer
ReplicatedStorage = game:GetService("ReplicatedStorage")
CodeBox = Interface:WaitForChild("TextBox")
ClickButton = Interface:WaitForChild("Clicker1")
LeaderStats = Player:WaitForChild("leaderstats")
DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")
ClickButton.MouseButton1Click:Connect(function()
DataSender1:FireServer(LeaderStats, "Action1")
end)
CodeBox.FocusLost:Connect(function(Entered)
if Entered then
DataSender1:FireServer(CodeBox.Text, "Action2")
end
end)
DataSender1:FireServer(Player,"Action3")
DataSender1.OnClientEvent:Connect(function(Player, Table)
print(Table[1], Table[2])
print("Works if it prints", Table)
end)
If i pasted this out correctly, you should see the full code