if EnemyHumanoid.Parent:FindFirstChild("NPC_Tag") then
if not DoubleSlaughters then
Value = .5
else
Value = 1
end
else
if not DoubleSlaughters then
Value = 1
else
Value = 2
end
end
print(Value) -- always prints either .5, 1, or 2
print(tonumber(Player.Slaughters.Value)) -- always prints the same as this next print*
Player.Slaughters.Value = tonumber(Player.Slaughters.Value) + tonumber(Value)
print(tonumber(Player.Slaughters.Value)) -- always prints the same as the previous print*
game.ReplicatedStorage.SlaughterUI_Events.Event2:FireServer(Value)
Can you explain? You arent really providing any info
All the info is there.
I’m simply trying to add a specific number (named Value) to a number value (which is named Slaughters). When I add it (i.e. Player.Slaughters.Value = tonumber(Player.Slaughters.Value) + tonumber(Value)
) it doesn’t actually change the number value.
Is this script a LocalScript or a ServerScript?
If you read the code you would know all this.
Client.
Why are you using tonumber()
if it’s already a digit?
that may be your issue, The Numbers might not be Changing because the Server is not recognizing the change
You don’t see what I mean.
The client doesn’t even recognise the change… which I have already indicated by showing that it prints the same value before and after changing it.
Because I thought that might be what was wrong, I added tonumber() and it didn’t change anything
My Point is:
LocalScript: Runs on the Client (Players Computer, Screen, View, etc)
Server Script (Or just Script): Runs on the Server (Can Make changes Globally)
Oh, alright
extend character limit please :))
You still don’t understand what I mean. I’m not that dumb.
Tell me if you understand my previous message.
It looks like right here on
if not DoubleSlaughters then
Value = .5
else
Value = 1
end
else
if not DoubleSlaughters then
Value = 1
else
Value = 2
end
end
You’re doing the same if statements, but re-changing the values
That has not nothing to do with it as the Value is always greater than 0
Is that the entire function?
jdudbeh
Edit: meant to ask if that was the entire if statement
Is Value set to be Player.Slaughters.Value? You don’t really include enough info. If that’s what it’s supposed to be, you’re changing the variable and not the actual value.
Player.Slaughters.Value = .5
No, he wants to increment it.
Try cutting the tonumber
s and go with Player.Slaughters.Value += Value
Is that all of your code?
Character limit
Are you doing something like this?
Value = NumberValue.Value --> 5
Value = 3
print(Value) --> 3
print(NumberValue.Value) --> 5?? it didnt change
If so, you’re changing the variable, but not the number value.
Just set the numbervalue’s value to Value
.
That’s what I thought too, but it’s not. He’s directly changing it in between the print statements.