Here is my script:
local clickd = script.Parent
clickd.MouseHoverEnter:Connect(function(playerWhoHovered) print("hi") print(playerWhoHovered.Others.Isbuilding.Value) while true do wait(0.5) print(playerWhoHovered.Others.Isbuilding.Value) end end)
There is a clickdetector, and there is actually a value in a folder called others that is created when a player joins. The problem is, it just keeps on printing what the value is when the script starts.
For example, when the game starts it keeps printing false. This makes sense, because the value is actually "false". But when I change the value to "true" , (via script or properties tab), it keeps on printing "false"!
Of course, this is just an example of the script having the wrong value, the goal of this script is not to print text.
Also, this is a normal script.
Any help would be appreciated, thanks!
This error is actually very common among newer scripters, so don't get embarrassed.
So, as I am sure you know there are two different types of scripts, local and server, right? Well, that applies to the corresponding parents as well, as Scripts
run on the Server
and LocalScripts
run on the Client
. This is important when developing too, there is nothing wrong with the script, but rather the way you changed the value, if you use the explorer while in a play test it will print what the Server
sees not what the Client
sees.
Also I cannot
say this for sure, as I do not use click detectors a bunch, but I believe that hovering is also not an option there?
To further explain Client
and Server
, when a change occurs on the Client
, it is done by a LocalScript
and on the Server
it is a Script
. So, if you want the value to read correctly change it VIA a Script
to make sure that it changes and the server sees the change.
The reason ROBLOX has the platform ran this way is due to exploiters, which recently only get good exploits with serversided scripts / virus infestations. This is why when a hacker joins a game and deletes the whole map, only they can see that change and only they are effected by the change.
Hope this helped! Let me know if it didn't.