#Audio doesnt play when i click left mouse button

1 messages · Page 1 of 1 (latest)

tough linden
#

hey everyone , im trying to make it where if a player picks up a tool and then clicks the left mouse button then a sword swinging audio plays, but for some reason it doesnt work at all, i have spent hours on this code trying to figure out the problem and i cant seem to find where the problem is, just wondering if anyone could help me here

i am new to luau btw so sorry if this code looks a bit weird

wise python
#

is this a server script?

#

also to check if it exists without getting an error you gotta do :FindFirstChild()

#

on the swordswingaudio

thin perch
#

use FindFirstChild. There is no reason to check if it exists if you dont use findfirstchild, beacuse it will error the script

#

if it is nil ofc

#

and also it might be the volume. I have noticed when increasing volume to a high number roblox just dosent allow it and just dosent play the sound

#

also make sure it is a local script

tough linden
orchid badgeBOT
#

studio** You are now Level 2! **studio

tough linden
#

in a tool

wise python
#

Any output?

tough linden
#

No outputs

#

no sounds played at all sadly

vague wyvern
#

maybe you can use context action service if you know bout that?

#

when you equip the tool bind a function that just makes if you press the input then play the sound

#

if you dont know what it is search up a tutorial

#

im bad at scripting srry if this doesnt make sens

tough linden
tough linden
#

i used findfirstchild but it didnt work , i tried waitforchild but it also didnt work

#

i do get a error saying that "part is not a valid member of workspace"

thin perch
#

then use waitforchild and if part dosent exist then just change the instance

tough linden
thin perch
#

an instance is a thing, like a part or a sound or a script inside the workspace or replicated storage

#

so if the part dosent exist then just change the instance to a part that exist

tough linden
#

alright i'll try that

tough linden
#

i fixed the problem