Hello,
I’m currently trying to add pet boosts to AlvinBlox’s egg hatching system, what i did is adding an IntValue to the pet and names it boost
then in my tool script i wrote this:
local currentValue = script.Parent.SlashesIncrease.Value
local function onValueChanged()
local newValue = script.Parent.SlashesIncrease.Value
currentValue = newValue
end
script.Parent.ActivateTool.OnServerEvent:Connect(function(plr)
local Slashes = game.Players[script.Parent.Parent.Name].leaderstats.Slashes
script.Parent.SlashesIncrease.Value = script.Parent.SlashesIncrease.Value * plr.EquippedPet.PetBoost.Value
script.Parent.SlashesIncrease:GetPropertyChangedSignal("Value"):Connect(onValueChanged)
Slashes.Value = Slashes.Value + script.Parent.SlashesIncrease.Value + plr.leaderstats.Upgrades.Value
end)
then i added an IntValue to the player here is what it looks like:
then i added a script to serverscriptservice and i wrote this:
while wait(.2) do
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
if character:FindFirstChild(player.Name.."'s Pet") then
player.EquippedPet.PetBoost.Value = character:FindFirstChild(player.Name.."'s Pet").Boost.Value
else
player.EquippedPet.PetBoost.Value = 1
end
end
but it doesn’t update his PetBoost value however when i change it myself from the server it give the boost
Thank you!