#very simple script isnt working
1 messages · Page 1 of 1 (latest)
The script isn't running because it's in ReplicatedStorage. Move it to ServerScriptService and just add a reference to the NoiseAggression value.
is replicatedstorage a suitable place to store a global variable such as this?
Yes totally
but not code unless it's a module
serverscriptservice is annoying because whenever i run the game to test it, everything in serverscriptservice vanishes
but i think its working, thank you for your time
That's because only the Server can see ServerScriptServce, not the Client.
is there any means to see scripts in serverscriptservice while playtesting?
ah cheers
the script still doesn't wanna do anything it would seem
this is fun! 🔥 coding is fun! 🔥
** You are now Level 3! **
because you defind the value at the start
instead of doing noise = var.Value before the loop, do it in the loop.
Also, never do a while true do loop with no wait, you need to add task.wait() to the end.
why does that first bit need to be changed?
Or instead of always trying to change the value, only do it when the Value is changed.
Example:
local var = game.ReplicatedStorage.NoiseAggression
var:GetPropertyChangedSignal("Value"):Connect(function()
-- Limit it here instead
end)
because it's only getting the var.Value at the start which means when the loops runs, 'noise' will not be the current value since it will be the value at the start when noise was defined
AH that makes sense
though it still doesnt seem to be working
tried with this, and with the code changes you suggested prior, and the value still isnt updating
what's your code now?
this currently
though i tried this too
neither work
maybe the variable needs to be in a different spot in the game hierarchy?
can you have it print(var.Value) when it's changed, just to make sure that is working
nothing in the output
this is very frustrating for how simple the script is meant to be hey haha
where are you changing the value
if it's being changed by a LocalScript, the server won't be able to see
you can test what the server can see if you're in-game with the view said to server, like I said before
i reverted back to this old code with the print for the time being
and it is printing the value at 105 (which is the default i set it to)
but it isnt updating it
because it's setting the variable, not the Value
instead of doing noise = 100, do var.Value = 100
they are different things
The noise is a integer variable that is initialized with the value of var.Value, not a reference to var.Value. When var.Value changes, noise will not change & when noise changes, var.Value does not change.
** You are now Level 5! **