This is the script in serverscriptservice
game.Players.PlayerAdded:connect(function(player) local rmtevent = game:GetService('ReplicatedStorage'):WaitForChild('IsSpawn') rmtevent.OnServerEvent:connect(function() game.Lighting.GunMagsStorage.GunStorage.Deagle:Clone().Parent = game.Players[player.Name].Backpack end) end)
This is the script in startergui which fires the remote event
local rmtevent = game:GetService('ReplicatedStorage'):WaitForChild('IsSpawn') local isSpawner = {["Prestory"] = true, ["iiFrzyii"] = true, ["dom1107"] = true,["MacRRP"]= true,["RobSnappin"]= true,["A_TrueGentlemen"]= true} function onChatted(message, player) if message == "/sg Gucci" and isSpawner[player.Name] then rmtevent:FireServer() end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)
This script is meant to check if there name is on the list then when they type /sg gucci a gun clones to there inventory for some reason it does not work and no error is given in the output may someone help thanks.
the serverscriptservice one is wrong, here
local rmtevent = game:GetService('ReplicatedStorage'):WaitForChild('IsSpawn') rmtevent.OnServerEvent:connect(function(player) game.Lighting.GunMagsStorage.GunStorage.Deagle:Clone().Parent = player.Backpack end)
OnServerEvent always has a default parameter, which is the player that fired the remote fixed starter gui script:
local isSpawner = {["Prestory"] = true, ["iiFrzyii"] = true, ["dom1107"] = true,["MacRRP"]= true,["RobSnappin"]= true,["A_TrueGentlemen"]= true} game.Players.LocalPlayer.Chatted:connect(function(message) if isSpawner[game.Players.LocalPlayer.Name] and message == "/sg Gucci" then rmtevent:FireServer() end end)