I have this code “Note this is only a part of the code, tell me if you need more.”
UserInput.InputBegan:Connect(function(input, typing, gameProcessedEvent)
if SlotTwoActive == true then
if typing == false then
if InAction == false then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
InAction = true
AnimationStopOverHull(“Aim”)
AnimationStopOverHull(“Idle”)
if AimedIn == true then
Humanoid:LoadAnimation(PistolAnims:FindFirstChild(“Shoot”)):Play()
delay(0,function()
Rep.RemoteEvents.Fire:FireServer(Char.DRGPistol,“rbxassetid://5805894981”)
end)
wait(0.25)
Humanoid:LoadAnimation(PistolAnims:FindFirstChild(“Aim”)):Play()
else
Humanoid:LoadAnimation(PistolAnims:FindFirstChild(“ShootUnaimed”)):Play()
delay(0,function()
Rep.RemoteEvents.Fire:FireServer(Char.DRGPistol,“rbxassetid://5805894981”)
end)
wait(0.5)
Humanoid:LoadAnimation(PistolAnims:FindFirstChild(“Idle”)):Play()
end
InAction = false
end
When ever I do this command in the script “Rep.RemoteEvents.Fire:FireServer(Char.DRGPistol,“rbxassetid://5805894981”)”
im firing on an event so that the server can make a shooting effect on the gun,
but it keeps sending the part that says “Char.DRGPistol” as nil. Yet this is a model in the players character.
here is my server sided script that fires off of the event
Rep.RemoteEvents.Fire.OnServerEvent:Connect(function(plr,Gun,Soundid)
local Char = plr.Character print(Char)
print(Gun)
local Flash = Rep.GunEffects:FindFirstChild(“NuzzleFlash”):Clone()
local Weld = Instance.new(“Weld”)
local Sound = Instance.new(“Sound”) print(Sound)
Flash.Parent = Char
Flash.Position = Char.HumanoidRootPart.Position
Sound.Parent = Flash
Sound.SoundId = Soundid
Sound:Play()
wait(1)
Flash:Destroy()
print("Fired")
end)
And whenever it prints “Gun” it prints nil and so I can’t move the effect to the Guns Nuzzle.
Have any solutions?