Help with scripting


#1

Why this resource doesnt work?
client.lua

AddEventHandler("playerSpawned", function() 
	TriggerServerEvent("plrSpw")
end)

server.lua

RegisterServerEvent("plrSpw")
AddEventHandler("plrSpw",  function() 
	GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_ASSAULTSMG"), 100, false, true)
end)

__resource.lua

client_script "client.lua"
server_script"server.lua"

I am new so sorry for my big mistakes


#2

The GiveWeaponToPed needs to be run from the client.


#3

Ok thanks <3 [20 char]