I am using a play button that sends to the server so it can check for classes, and team, etc, and if its on blue it goes to the blue spawn, if its on red it goes to red spawn. (It doesn’t give any weapons either?)
What am I doing wrong here?
local spn = game.ReplicatedStorage.Spawn
spn.OnServerEvent:Connect(function(plr,class)
local bpk = plr.Backpack
local char = plr.Character
local ars = game.ServerStorage.Arsenal
local redp = workspace.Map:FindFirstChild("redP")
local blup = workspace.Map:FindFirstChild("bluP")
if class.Value == "Assault" then
local a1 = ars.SMG:Clone()
local a2 = ars.PISTOL:Clone()
local a3 = ars.GRN:Clone()
a1.Parent = bpk
a2.Parent = bpk
a3.Parent = bpk
if plr.Team == "Rebels" then
char.HumanoidRootPart.Position = redp.Position
elseif plr.Team == "Defenders" then
char.HumanoidRootPart.Position = blup.Position
end
elseif class.Value == "Rifleman" then
local a1 = ars.AR:Clone()
local a2 = ars.PISTOL:Clone()
local a3 = ars.GRN:Clone()
a1.Parent = bpk
a2.Parent = bpk
a3.Parent = bpk
if plr.Team == "Rebels" then
char.HumanoidRootPart.Position = redp.Position
elseif plr.Team == "Defenders" then
char.HumanoidRootPart.Position = blup.Position
end
elseif class.Value == "Raider" then
local a1 = ars.SHOTGUN:Clone()
local a2 = ars.PISTOL:Clone()
local a3 = ars.GRN:Clone()
a1.Parent = bpk
a2.Parent = bpk
a3.Parent = bpk
if plr.Team == "Rebels" then
char.HumanoidRootPart.Position = redp.Position
elseif plr.Team == "Defenders" then
char.HumanoidRootPart.Position = blup.Position
end
elseif class.Value == "Marksman" then
local a1 = ars.SNIPER:Clone()
local a2 = ars.PISTOL:Clone()
local a3 = ars.GRN:Clone()
a1.Parent = bpk
a2.Parent = bpk
a3.Parent = bpk
if plr.Team == "Rebels" then
char.HumanoidRootPart.Position = redp.Position
elseif plr.Team == "Defenders" then
char.HumanoidRootPart.Position = blup.Position
end
elseif class.Value == "Rocketeer" then
local a1 = ars.RKTL:Clone()
local a2 = ars.PISTOL:Clone()
local a3 = ars.GRN:Clone()
a1.Parent = bpk
a2.Parent = bpk
a3.Parent = bpk
if plr.Team == "Rebels" then
char.HumanoidRootPart.Position = redp.Position
elseif plr.Team == "Defenders" then
char.HumanoidRootPart.Position = blup.Position
end
end
end)
local class = script.Parent.Parent.Class
local spn = game.ReplicatedStorage.Spawn
script.Parent.MouseButton1Click:Connect(function()
spn:FireServer(class)
script.Parent.Parent.Enabled = false
print(class.Value)
end)
Instead of sending over a value, replace everything to just strings. For instance:
local class = script.Parent.Parent.Class
local spn = game.ReplicatedStorage.Spawn
script.Parent.MouseButton1Click:Connect(function()
spn:FireServer(tostring(class.Value))
script.Parent.Parent.Enabled = false
end)
You’re going to have to make some adjustments in the server script but it shouldn’t be too hard.