So in my game players can buy hat crates and wear the hat but right now I want it to multiply their leadestats value when they wear them. ex. when a player collects a lollipop that gives the 5 sugar if they are wearing a hat the has an x5 multiplier then they will get 25 sugar.
You could do something like:
if plr.Character:FindFirstChild("HatName") then
plr.Multiplier.Value = 5
end
That is if you have a multiplier value inside of the player that stores the multiplier.
Using the multiplier value on their current sugar value in a variable should do the job.
Was thinking how he would be able to keep the base value at first.
Attributes are beautiful, modern and new - not to mention are much more efficient than using FindFirstChild
(atleast in my testing conditions by sometimes up to 0.2 seconds in barely developed games and actual seconds in largecale projects)
Simply use Player:SetAttribute("HatName", true)
or wherever you want to set the attribute when you give them the hat, then use Player:GetAttribute("HatName")
in the lollipop pickup script and do an If
statement for the attribute.
Example:
if Player:GetAttribute("HatName") then
Player.Multiplier.Value = 5
end
Good idea! Iām just not a big fan of modern features because of person preference.