Hi, I'm trying to do simple stuff with guns. Here, when the player equips the gun, all the stuff happens. However, studio says: Pistol.LocalScript:12: attempt to call field 'Equipped' (a userdata value)
Here's the LocalScript:
--defining things
local MaxAmmo = script.Parent.ClipSize.Value
local Ammo = MaxAmmo
local Reloading = false
local reloadTime = script.Parent.ReloadTime
local gun = script.Parent
--Cursor
gun.Equipped(function(Mouse)
Mouse.Icon = "rbxasset://textures://GunCursor.png"
script.Parent.Activated:Connect(function()
if Ammo>0 then
Ammo=Ammo-1
elseif Reloading == false then
Reloading = true
Mouse.Icon = "rbxasset://textures://GunWaitCursor.png"
wait(reloadTime.Value)
Reloading = false
Mouse.Icon = "rbxasset://textures://GunCursor.png"
end
print(Ammo)
end)
end)
Any help is appreciated!
