I don't think that the error you are getting is part of the script above as you do not access the humanoid in the characters model.
We now have a whole service to manage the users input called UserInputService which is why KeyDown and KeyUp deprecated so please do not use them.
As you have posted a script I will give an example, this also uses a remote event as you should have FilteringEnabled:-
Server script:-
local remoteFire = Instance.new('RemoteEvent', game:GetService('ReplicatedStorage'))
remoteFire.Name = 'remoteFire'
remoteFire.OnServerEvent:connect(function(plr, fire)
local char = plr.Character
if char then
if fire then
if char['Left Arm'] then
local fire = Instance.new('Fire', char['Left Arm'])
print('Fire added')
else
print('Character model does not have a left arm')
end
else
end
else
print('Character model is nil')
end
end)
This is a local script in StarterPlayerScripts:-
local usrInpServ = game:GetService('UserInputService')
local remoteFire = game:GetService('ReplicatedStorage'):WaitForChild('remoteFire')
local deb = true
usrInpServ.InputBegan:connect(function(inputObj, gameProcEvent)
if deb then
if inputObj.UserInputType == Enum.UserInputType.Keyboard then
if inputObj.KeyCode == Enum.KeyCode.Z then
deb = false
remoteFire:FireServer(true)
wait(10)
deb = true
end
end
end
end)
I hope this helps, please comment if you do not understand how/why this script works.
1 comment
By default FE is disabled