The local script works completely fine, the prints and such work. The server script print does not print. This is very confusing as this should be correct and is very important to my scripts. There are no errors or yields in the output.
--Server script
game.ReplicatedStorage.DeadBodyItemCreate.OnServerEvent:Connect(function(plr, corpse, item) print('Recieved') local Wcorpse = workspace:WaitForChild(corpse.." Corpse").Inventory:WaitForChild(item) Wcorpse.Value = Wcorpse.Value - 1 local plrItem = plr.Inventory:WaitForChild(item) plrItem.Value = plrItem.Value + 1 end)
--Local script
local item = script.Parent.Parent.Parent local ItemName = item.Name local amount = item.ItemCount.ItemValue local CorpseName = item.Parent.Parent.PlayerName.Value print(CorpseName) game.ReplicatedStorage.DeadBodyItemCreate:FireServer(CorpseName, ItemName) print(CorpseName.." Corpse")
all of the values are correct. The server script is inside ServerScriptService, and the local script is inside a startergui. https://imgur.com/9vbpkPo that is the picture of the local script (at the bottom)
Okay, so it's almost just fine, but there's just one problem. I think it's kind of stupid that it has to be like this, but when you're firing a server, you have to put in all the parameters as something, or else it won't work. If you don't need a certain parameter for something, then if possible, just remove it in the server script, otherwise just put it as nil in the :FireServer().
Here's how it would look:
Local:
local item = script.Parent.Parent.Parent local ItemName = item.Name local amount = item.ItemCount.ItemValue local CorpseName = item.Parent.Parent.PlayerName.Value print(CorpseName) game.ReplicatedStorage.DeadBodyItemCreate:FireServer(CorpseName, ItemName,nil) -- There was 3 parameters in the .OnServerEvent, so you need to include three different variables in the fire server. print(CorpseName.." Corpse")
The server would remain the same unless you were to remove the third parameter, then you would just have 2 in the local one too. Basically, to sum it up, you need to have the same amount of variables in the fire server as parameters in the .OnServerEvent.
Hope I helped!