I am trying to create a choppable tree where I am trying to change the value of hits on being hit by an axe the value is changing but it is not being updated in the script when the value changes
Script:
I am trying to create a choppable tree where I am trying to change the value of hits on being hit by an axe the value is changing but it is not being updated in the script when the value changes
Script:
LocalScripts do not execute under Workspace unless they are a descendant of the Player’s character. Place the script inside StarterPlayer > StarterPlayerScripts
instead, where they will be automatically parented to the Player’s PlayerScripts and execute.
Will the Script work if they are inside a model?
I am talking about Server Script if they will execute in a model when a certain value is changed through .Changed event
Yes it should do
It will work as it is a script running from the server. Always keep scripts in ServerScriptService instead of workspace as exploiters can access them in workspace.
Server scripts can be ran from models if that’s what you’re getting at. Do try and be more clear.
I am trying to create a choppable tree where I am trying to change the value of hits on being hit by an axe the value is changing but it is not being updated in the script when the value changes
Hackers cannot or view or edit the content of Scripts or make replicated changes in any way, unless they have access through the server.
Chances are that you may be hitting it too fast in a short period of time.
You could put a debounce
Well when I change the value through workspace it still does not work.
From what I see, it appears that you only printed the value at the beginning. It looks like your print line is outside of actual changed function. You should include the print line inside your changed function.
The value is being updated on the client. You are getting the value on the server. Client changes do not replicate to the server in most cases, including this one.
So should I change the axe hitting script to server script?
Yes, or use remote events.
I used remote events and it is working now thanks for help