You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve?
What I would like to achieve is to make a functional surface gui for a radio in a boat in my game.
- What is the issue?
The issue I am having with this is when I try passing a string through a remote event from a local script to a server script and print the string, it always returns as nil.
Here’s an image of the output:
- What solutions have you tried so far?
I have tried changing some code around and making different ways of passing the string to the server script.
Here is the code in the code in the local script along with the gui in startergui:
local part = script.PartName.Value
local ID = script.Parent.Frame.ID.Text
local enter = script.Parent.Frame.enter
local event = game.ReplicatedStorage.Events.ChangeAudioID
enter.MouseButton1Click:Connect(function(player)
event:FireServer(player,part,ID)
end)
Here is the code and photo of the server part of it:
local event = game.ReplicatedStorage.Events.ChangeAudioID
local audio = script.Parent.Sound
event.OnServerEvent:Connect(function(player,part,ID)
print("Player: "..player.Name)
print("Part: "..part)
print("ID: "..ID)
if part == script.Parent.Name then
audio.SoundId = "rbxassetid://"..ID
audio:Play()
end
end)
EDIT:
Here is the remote event in replicated Storage:
Thank you for anything that may help with fixing this issue.