Trying to send variables from a Local Script to a normal Script. I coded it to print the variables after being sent (to Script) but I keep getting "nil". I've tried searching it up on Google but no success. (New to scripting so please forgive me if there are any idiotic errors)
Local Script:
local MorseCodePassing = game.ReplicatedStorage:WaitForChild("MorseCodePassing") local name = "A" local morsetext = ".-" script.Parent.MouseButton1Click:Connect(function(name, morsetext) function Button(name, morsetext) if game.StarterGui.LettersMenu.Frame.Visible == false then game.StarterGui.LettersMenu.Frame.Visible = true end MorseCodePassing:FireServer(name, morsetext) end end)
Normal Script:
local MorseCodePassing = game.ReplicatedStorage:WaitForChild("MorseCodePassing") MorseCodePassing.OnServerEvent:Connect(name, morsetext) print(name) print(morsetext)
I Saw Alot Of Mistakes But As Your A New Scripter Here You Go
Script
local MorseCodePassing = game.ReplicatedStorage:WaitForChild("MorseCodePassing") -- Normal Script MorseCodePassing.OnServerEvent:Connect(function(plr,name, morsetext) -- Mistake Is That You Didnt Added The Plr At First print(name) print(morsetext) end)
Local Script
local MorseCodePassing = game.ReplicatedStorage:WaitForChild("MorseCodePassing") -- Local Script In A TextButton Or Anything You Want local name = "A" local morsetext = ".-" local Button = script.Parent -- Directory To text Button Button.MouseButton1Click:Connect(function() MorseCodePassing:FireServer(name, morsetext) end)