What do you want to achieve? I’m trying to make a playlist in which users can add music to this playlist and have it play in game via SurfaceGUI
What is the issue? The songs (Put in by SoundID) Appear to add to the playlist on the client side, but nothing happens on the server side. No errors or anything.
What solutions have you tried so far? I have tried using BindableEvents and RemoteEvents to no avail. Even while using :GetPropertyChangedSignal I have no idea what I’m doing wrong.
IDHandlerClient
local Event = game.ReplicatedStorage.BoxChange
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
Event:FireServer(script.Parent.Text)
end)
IDHandlerServer
local Event = game.ReplicatedStorage.BoxChange
Event.OnServerEvent:Connect(function(plr, TEXT)
print(TEXT, "Server")
end)
local RS = game:GetService("ReplicatedStorage")
local MS = game:GetService("MarketplaceService")
local idbox = script.Parent.Parent.ID
local typedID = idbox.Text
local newCopy = script.Parent.Parent.Parent.Parent.Parent.Storage.Song
script.Parent.MouseButton1Click:Connect(function()
local texttonumber = tostring(idbox.Text)
if idbox.Text == nil then
print("no id inputted")
else
local song = MS:GetProductInfo(texttonumber)
if song.AssetTypeId == 3 then
print("is a song")
newCopy.SongID.Value = texttonumber
newCopy.SongName.Value = MS:GetProductInfo(texttonumber).Name
newCopy.Creator.Value = MS:GetProductInfo(texttonumber).Creator.Name
newCopy.TextLabel.Text = newCopy.SongName.Value.." | "..newCopy.Creator.Value.." | "..newCopy.SongID.Value
newCopy.Order.Value += 1
newCopy:Clone().Parent = script.Parent.Parent.Songs
Also()
else
print("not a song")
typedID = idbox.Text
idbox.Text = "Please enter a valid SoundID."
wait(3)
idbox.Text = typedID
end
end
end)
function Also()
script.Parent.Parent.Parent.Parent.AddSong:Fire(
MS:GetProductInfo(tonumber(idbox.Text)).Name,
idbox.Text,
MS:GetProductInfo(tonumber(idbox.Text)).Creator.Name,
newCopy.SongName.Value.." | "..newCopy.Creator.Value.." | "..newCopy.SongID.Value
)
end
Before I go further, I see that you clone the “newCopy” on both the client and the server, parenting the clones into “Songs”. Did you mean to just clone it on the server only?
Besides that, I’d recommend putting print statements around your code, especially in the Also function as that will tell you where it’s potentially stopping. I don’t really see why this wouldn’t work unless there’s some form of argument error in the IF statements.
I just tested the code and it seems to stop at script.Parent.Parent.Parent.Parent.AddSong:Fire(). It could be the fact that I’m trying to fire a BindableEvent from a script with the RunContext Set to Client, but IIRC you can fire BindableEvents from a Client script on a server
EDIT: I switched out the BindableEvent for a RemoteEvent and it seems to work, but the text is all wonky and everything is shifted up a value. Creator is SongID, SongID is SongName, and SongName is my username (???). It works, but it also doesn’t.
oh. I should’ve noticed that earlier LOL. well you’re on the right track and all I really gotta say is that when you are receiving a RemoteEvent from a client as a server, you have to have a parameter in the receiving function for the player (the first parameter specifically). This documentation piece here is a good guide for Remote Events