As much as I am a newbie and I am just learning scripting I have been looking for a solution to this issue but I could not find the solution anywhere, so I am asking for help here
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local buttonClickEvent = ReplicatedStorage:WaitForChild("TextButton")
if buttonClickEvent then
local button = script.Parent
button.MouseButton1Click:Connect(function()
local player = game.Players:GetPlayerFromCharacter(button.Parent)
local value = math.random(1, 5)
buttonClickEvent:FireServer(player, value)--value never displayed on server side!!!!!
end)
end
^ this is my script example ^ in this script I try to send value and player name to the server side
local buttonClickEvent = Instance.new("RemoteEvent")
buttonClickEvent.Name = "TextButton"
buttonClickEvent.Parent = game.ReplicatedStorage
buttonClickEvent.OnServerEvent:Connect(function(player,value)
print(player,value)-- Always only prints Player name and nil :(
end)
^ this is the server side script that is supposed to print the player name and value but it only prints player name and “nil”
I don’t know how to fix this, I wasted too much time on this simple seeming issue
thank you so much!
I am just a beginner at studio stuff and new to the dev forums
do you have anything you can recommend me to learn scripting quicker? For now I am just typing random nonsence and making a game out of it