Okay, so I’m trying to make a value inside the player object go up when they click an object, and to do that, I need to create said value. The following is the script I had so far. It was in starterplayerscripts.
r = script.Parent
h = Instance.new("IntValue")
h.Parent = r
h.Name = "AsbestosRemoved"
h, or AsbestosRemoved, is not existent within the player, which means that all of the scripts that rely on it are broken as a result.
I’ve tried relocating the script and moving it to startercharacterscripts and using getplayerfromcharacter. Nothing so far has worked.
Avoid bypassing the character limit, as it’s wrong.
Non-Replicated Instances
If the value being sent is only visible to the sender, nil will be passed instead of the value. For example, if a server tries to pass a descendant of ServerStorage , the client listening to the event will see a nil value because that object isn’t replicated to the client.
Similarly, if a client creates a part and tries to pass it to the server, the server will see a nil value because the part isn’t replicated to the server.
function addValueToPlayer(targetPlayer)
local val = Instance.new("IntValue");
val.Name = "AsbestosRemoved";
val.Parent = targetPlayer;
end
game:GetService("Players").PlayerAdded:Connect(addValueToPlayer); --Adds this value to any player who joins