[Darkrp] Making single jobs walking speed faster

I want to make the walking speed of one of my jobs a bit fast than the others. How can I do this?

First off, DarkRp questions don’t go here. As for your question:

Check what team their in and if they’re in team X then set their speed to your liking using GAMEMODE:SetPlayerSpeed(ply, 350, 650)

Example:



function Loadout( ply )
     if team.GetName( ply:Team() ) == "Cop" then
        GAMEMODE:SetPlayerSpeed(ply, 350, 600)
    else
	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
    end
     return true
end
 
hook.Add( "PlayerLoadout", "PlayerLoadouts", Loadout)


And if the name of the team isn’t ‘Cop’ ? Just check if team == TEAM_CP

I seem to be going the same speed

How did you use the code? Where did you put it?

I made a new module for it in gamemode/modules/speedchange.lua

Eh, not so sure about darkrp modules. Did you change what team it checks for or just put what I gave you?

Well, I did the same thing with a similar code for with armor and it worked in modules. Also, I did change the team.

Did you include the file in the init.lua?

Edit: brandonj4 stop marking my shit as dumb you stupid fuck.

This was the code for the armor that I placed in Darkrp/gamemode/modules/juggerarmor.lua:



function ArmorSpawn( ply )
	if ply:Team() == TEAM_JUGG then
		ply:SetArmor(100)
	end
end
hook.Add( "PlayerLoadout", "ArmorSpawn", ArmorSpawn )


It is very similar to your code:



function Loadout( ply )
     if team.GetName( ply:Team() ) == "Cop" then
        GAMEMODE:SetPlayerSpeed(ply, 350, 600)
    else
	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
    end
     return true
end
 
hook.Add( "PlayerLoadout", "PlayerLoadouts", Loadout)


So I figured I would put it in modules as well. I also did not include it in the init.lua because I made it a module

Ok try:


function SpeedyJobs( ply )
     if ply:Team() == TEAMNAME then
        GAMEMODE:SetPlayerSpeed(ply, 350, 600)
    else
	GAMEMODE:SetPlayerSpeed(ply, 250, 500)
    end
end
 
hook.Add( "PlayerLoadout", "SpeedyJobs", SpeedyJobs)

Do it the same as the juggernaut armor ( place in modules folder or whatever ). Sorry you’ve had to try this 10 times. I usually don’t work with teams. I think it was the GetName that was making it not work.

Still didn’t seem to work. what if we change it from



        GAMEMODE:SetPlayerSpeed(ply, 350, 600)
    else
	GAMEMODE:SetPlayerSpeed(ply, 250, 500)


to



        ply:SetPlayerSpeed(ply, 350, 600)
    else
	ply:SetPlayerSpeed(ply, 250, 500)


Dafaq? Try restarting your server.

changing to ply didn’t work either…

Already knew it wouldn’t, the function doesn’t operate like that. Please double check the team name. Is the module in the modules folder?

Yes, the module is in the modules folder

Does the file name have the sv_ prefix on it? Any console errors?

no, I just named it speedchange.lua and no console errors

Add sv_ in front of it.

Still nothing