im starting to finish my simulator game so i tried making it so the weight will change size with the player's strength. there are no errors but it deletes datastore and doesnt change size. can somone help?
local serverStorage = game:GetService("ServerStorage")
local datastore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local strength = Instance.new("NumberValue")
strength.Name = "Strength"
strength.Parent = leaderstats
local rebirths = Instance.new("IntValue")
rebirths.Name = "Rebirths"
rebirths.Parent = leaderstats
local dataFolder = Instance.new("Folder")
dataFolder.Name = player.Name
dataFolder.Parent = serverStorage.RemoteData
local debounce = Instance.new("BoolValue")
debounce.Name = "Debounce"
debounce.Parent = dataFolder
local strengthdata, rebirthdata
local success, errormessage = pcall(function()
strengthdata = datastore:GetAsync("strength-"..player.UserId)
rebirthdata = datastore:GetAsync("rebirths-"..player.UserId)
end)
if success then
if strengthdata then
strength.Value = strengthdata
rebirths.Value = rebirthdata
end
end
player.CharacterAppearanceLoaded:Connect(function(character)
local humid = character.Humanoid
humid:WaitForChild("BodyDepthScale").Value = .5 + (strength.Value / 250)
humid:WaitForChild("BodyHeightScale").Value = .5 + (strength.Value / 250)
humid:WaitForChild("BodyWidthScale").Value = .5 + (strength.Value / 250)
humid:WaitForChild("HeadScale").Value = .5 + (strength.Value / 250)
humid.WalkSpeed = 16 + (strength.Value / 250)
strength:GetPropertyChangedSignal("Value"):Connect(function()
humid:WaitForChild("BodyDepthScale").Value = .5 + (strength.Value / 250)
humid:WaitForChild("BodyHeightScale").Value = .5 + (strength.Value / 250)
humid:WaitForChild("BodyWidthScale").Value = .5 + (strength.Value / 250)
humid:WaitForChild("HeadScale").Value = .5 + (strength.Value / 250)
humid.WalkSpeed = 16 + (strength.Value / 250)
game.StarterPack:WaitForChild("Weight").Size.Value = .5 + (strength.Value / 250) -- this is where it wont work
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
datastore:SetAsync("strength-"..player.UserId,player.leaderstats.Strength.Value)
datastore:SetAsync("rebirths-"..player.UserId,player.leaderstats.Rebirths.Value)
end)
end)

5 comments
Which line is the "infinite yield possible" found on? If there are infinite yields then it shows you where the problem is occurring
Is the "Size" the Size Property of a Part or an Int/NumValue ?
idk
Try now, i made a slight adjustment
responding to your comment, ah ok, so the tool has a handle named "Handle" in it that is supposed to change size i suppose?