Hello guys.I’m trying to do a single use item on point shop. But for some reason didn’t worked.
ITEM.Name = 'SANIC MASK'
ITEM.Price = 100
ITEM.Model = 'models/props_junk/garbage_glassbottle003a.mdl'
ITEM.NoPreview = true
ITEM.SingleUse = true
function ITEM:OnEquip(ply, modifications)
timer.Simple(1, function()
ply:SetWalkSpeed(ply:GetWalkSpeed() + 200)
ply:SetRunSpeed(ply:GetRunSpeed() + 200)
end)
end
How can I fixed It?
Hello guys.I’m trying to do a single use item on point shop. But for some reason didn’t worked.
ITEM.Name = 'SANIC MASK'
ITEM.Price = 100
ITEM.Model = 'models/props_junk/garbage_glassbottle003a.mdl'
ITEM.NoPreview = true
ITEM.SingleUse = true
function ITEM:OnEquip(ply, modifications)
timer.Simple(1, function()
ply:SetWalkSpeed(ply:GetWalkSpeed() + 200)
ply:SetRunSpeed(ply:GetRunSpeed() + 200)
end)
end
How can I fixed It?
timer.Simple is just a delay. What you did was delay your function for one second, and then set their speeds. You never took them away after a period of time. What you should do is set their speeds to your desired level, and then make delayed function using timer.Simple that resets the player’s speed to the normal speed.
timer.Simple is just a delay. What you did was delay your function for one second, and then set their speeds. You never took them away after a period of time. What you should do is set their speeds to your desired level, and then make delayed function using timer.Simple that resets the player’s speed to the normal speed.
I know that, but player isn’t receiving speed after timer. same thing if I do that with player’s health. The code only works if SingleUse is false. But I don’t wanna that. I want a single use item, like: Buy, receive, use, end
I know that, but player isn’t receiving speed after timer. same thing if I do that with player’s health. The code only works if SingleUse is false. But I don’t wanna that. I want a single use item, like: Buy, receive, use, end
Are you running this on the client or server?
try changing ITEM:OnEquip to ITEM:OnBuy
changing ITEM:OnEquip to ITEM:OnBuy
ITEM.SingleUse uses only ITEM:OnBuy
ITEM.Name = 'SANIC MASK'
ITEM.Price = 100
ITEM.Model = 'models/props_junk/garbage_glassbottle003a.mdl'
ITEM.NoPreview = true
ITEM.SingleUse = true
function ITEM:OnBuy(ply, modifications)
timer.Simple(1, function( ply )
ply:SetWalkSpeed(ply:GetWalkSpeed() + 200)
ply:SetRunSpeed(ply:GetRunSpeed() + 200)
end)
end
changing ITEM:OnEquip to ITEM:OnBuy
ITEM.SingleUse uses only ITEM:OnBuy
ITEM.Name = 'SANIC MASK'
ITEM.Price = 100
ITEM.Model = 'models/props_junk/garbage_glassbottle003a.mdl'
ITEM.NoPreview = true
ITEM.SingleUse = true
function ITEM:OnBuy(ply, modifications)
timer.Simple(1, function( ply )
ply:SetWalkSpeed(ply:GetWalkSpeed() + 200)
ply:SetRunSpeed(ply:GetRunSpeed() + 200)
end)
end
You do still know that the script will not work anyway because of what I told you, right? Here’s what you should put in there if you want to have a temporary speed boost:
ply:SetWalkSpeed(ply:GetWalkSpeed() + 200)
ply:SetRunSpeed(ply:GetRunSpeed() + 200)
timer.Simple(1, function( ply )
ply:SetWalkSpeed(ply:GetWalkSpeed() - 200)
ply:SetRunSpeed(ply:GetRunSpeed() - 200)
end)