Are you able to use the print() or warn() commands on a local script?
Why I’m asking
I’m asking because I’m currently attempting to make a chant system and I have everything sound related working on the client for multiple reasons.
The issue
My issue is that everytime I copy the localscript into the audio to run the following code and it isn’t working at all. I have no way to detect if there is an issue with the coding. I’ve done my best to decode it through the server-side, the script is perfectly fine; so I have no idea why it’s not working on the client side, and seeing as the audio is being controlled on the client side; it genuinely makes no sense.
The Idea
A Chat command is said, (i.e; Bell Ring)
The audio is created and put in a folder on the Server,
A remote event is created and is fired to all the clients,
The Client Script then goes through the Workspace to find the said Audio and plays it.
Its Volume then rises by increments. The highest volume being whatever you send through the remote event and the lowest being 0.
This is where the issue comes into action.
The LocalScript below is then duplicated into the Sound,
The sounds volume is supposed to lower all the way down to 0 and then the script disables itself.
That’s it
Side Note
The reason I can’t use a server script for this is because the actual sound isn’t played through the server, for many different reasons revolving around the Client and Server Connection that I won’t get into.
The Local Script
wait(5)
while script.Disabled == false do
local Audio = script.Parent
if Audio.Volume > 0 then
Audio.Volume = Audio.Volume - .005
wait(.01)
else
script.Disabled = true
end
end
Just a question, when you equip tool, the tool goes in workspace.PlayerCharacter, the local scripts inside it runs, how is that possible, its in workspace
Because of Network ownership, if you have network ownership over a model or part, you will be able to control the part/model with local scripts and those action will replicate to the server, a player’s character network ownership is instantly given to said player once it spawns and thus allows local scripts inside of it to work. This networking behavior also explains why exploiters have complete control over their own character. Network ownership can only be set from the server.
Apologies for bumping, but I figured this is an important update to mention considering this is the top results on Google when searching for “Local Scripts in Workspace”.
The new Script instance now allows you to choose a RunContext. It was in Beta for while but is now Live. If you choose Client as the RunContext, you essentially have a local script, but it will run pretty much anywhere, including in the workspace.