Hey everyone, recently I’ve been working on a preset class system for my game. I’ve gotten most of the GUI for class selection done but for some reason this one class just won’t work. I’ve copied my other scripts that do work and for some reason it still won’t work.
I really don’t understand why this isn’t working…
What is suppose to happen is the player will open the Selection GUI, choose a team, choose their class, then die and respawn with their chosen class in the starter gear and which will then be in their backpack because they respawned. But what actually happens is the player will choose their class, then respawn with no weapons in their startergear.
-- Local Script
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvents.RemoteEventAssaultRU:FireServer()
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
script.Parent.Parent.Visible = false
end)
-- ServerScript
game.ReplicatedStorage.RemoteEvents.RemoteEventAssaultRU.OnServerEvent:Connect(function(player)
local Primary = game.ServerStorage.Tools:WaitForChild("AK-74M"):Clone()
Primary.Parent = player:WaitForChild("StarterGear")
local Secondary = game.ServerStorage.Tools:WaitForChild("R8 Revolver"):Clone()
Secondary.Parent = player:WaitForChild("StarterGear")
end)
Here is the exact same script just with different tools and a different remote event that does work.
-- Local Script
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvents.RemoteEventSupportRU:FireServer()
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
script.Parent.Parent.Visible = false
end)
-- Server Script
game.ReplicatedStorage.RemoteEvents.RemoteEventSupportRU.OnServerEvent:Connect(function(player)
local Primary = game.ServerStorage.Tools:WaitForChild("PKM"):Clone()
Primary.Parent = player:WaitForChild("StarterGear")
local Secondary = game.ServerStorage.Tools:WaitForChild("Ithaca 37"):Clone()
Secondary.Parent = player:WaitForChild("StarterGear")
end)
Can anyone help me with this?
Thanks.