For some reason, when I use the grenade, there's no error, but it doesn't play the sound when it explodes. I don't know how to fix this, can anyone help me?
BTW here is the script for the grenade:
local userInput = game:GetService('UserInputService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local grenadeSound = Instance.new('Sound')
grenadeSound.SoundId = "rbxassetid://1449829557"
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local grenadeEvent = ReplicatedStorage:WaitForChild('GrenadeEvent')
local function throw(input, gameProcessed)
if not gameProcessed then
if input.userInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.G then
grenadeSound:Play()
grenadeEvent:FireServer(mouse.Hit.p)
print("grenade")
end
end
end
end
userInput.InputBegan:Connect(throw)
** You are now Level 1! **