Issue when I rejoin

Okay so I spent 20k robux to hire a scripter and now hes ignoring me. I have no lua experience however I need to fix a bug where when you rejoin a game with other players your ingame slime is unable to grow.


are these scripts whats causing it?

In that first picture you sent, the leaderstats doesn’t even exist when the player joins. So you need to create the leaderstats with the function you created in the second picture (just copy that function over to script in the first pic) then create the leaderstats with it before waiting for it

If you have no lua experience then you can go to youtube and watch some tutorials ig, they’re quite good for starters

3 Likes

could definitely be an issue with the scripter having not adding any datastores.

the purpose of those datastores?
restore the slimes data and xp so that it’s able to grow.

what it seems like to me is that since the game didn’t save the slimes data, when it rejoins it has to start from 0 again. if the slimes size is too large then it’ll take a while to climb back up to where you were.

sorry this happened, make sure to always make sure the scripted you hire is trusted in the community and has fulfilled multiple jobs before.

being a intermediate scripter myself, I can’t see a fix to the code. hopefully someone else here can do that work for me :sweat_smile:

2 Likes

She is using profile service which is a better alternative to data stores, so there’s no reason why it wouldn’t have saved unless its something to do with the syntax

2 Likes

oh. don’t understand that too well seeing as i still need to delve into those realms of scripting haha :sweat_smile: I get the gist though.

I see it in the code now

1 Like

20k robux is overkill. You don’t even need to spend that much just for a scripter; a few thousand is fine. They were probably planning to scam you if they asked you for this much robux. Furthermore, don’t pay the entire robux straight away; pay like half of it once they’re doing with most of the code and the rest once they did their job.

2 Likes

You’re right, and I asked for a very simple game. Do u think roblox can refund me?

no. what’s done is done. if the scripter was already paid, it’s out of Roblox’s control. this is why, once more, make sure to always give a background check of who you hire.

1 Like

Do not send a screenshot of your code. Post the entire thing if you can and I’ll be glad to help.

```lua
– your code
```

20k is definitely overkill if it’s something simple like data, but 20k for an entire game is entirely reasonable. I, along with many developers I know, have been hired for hundreds of thousands of R$ to work and maintain a game.

1 Like

yes but leaving the game not fully functioning is just unfair.

I agree. Again, post the entire code and I’ll be happy to fix it for them.

2 Likes

roblox is unable to help with refunding any sort of transaction (thanks Roblox)

the scripts you have made appear to use bad practices (setting Parent the moment you create an Instance, etc.) but the errors seem to be coming from LocalScripts. Could you provide the code from the local scripts that have caused these “Infinite yield” issues?

2 Likes

This is the code for “playerManager”

local playerData = require(game.ServerScriptService.PlayerData.manager)
local mps = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = player:WaitForChild("leaderstats")
	local size = leaderstats:WaitForChild("Slime Size")

	local xpValue = Instance.new("IntValue")
	xpValue.Name = "xpValue"
	xpValue.Parent = player

	local xpGoal = Instance.new("IntValue")
	xpGoal.Name = "xpGoal"
	xpGoal.Parent = player

	local maxSize = Instance.new("NumberValue")
	maxSize.Name = "maxSize"
	maxSize.Parent = player
	maxSize.Value = 7.5

	local profile = playerData.Profiles[player]
	if not profile then
		warn("Profile not found for player: " .. player.Name)
		return
	end

	if mps:UserOwnsGamePassAsync(player.UserId, 895116240) or player.Name == "wxbd" then
		profile.Data.Data.maxSize = 9
	end

	size.Value = profile.Data.Data.Slime

	runService.Heartbeat:Connect(function()
		xpValue.Value = profile.Data.Data.Experience
		xpGoal.Value = profile.Data.Data.XpGoal
		maxSize.Value = profile.Data.Data.maxSize * profile.Data.Data.maxSizeMulti 

		if xpValue.Value >= xpGoal.Value then
			profile.Data.Data.Experience = xpValue.Value - xpGoal.Value
			profile.Data.Data.Level += 1
			profile.Data.Data.XpGoal += 500
			leaderstats.Level.Value = profile.Data.Data.Level
			game.ReplicatedStorage.events.playSound:FireClient(player, "lvlUp")
		end

		local slime = workspace.slimes:FindFirstChild(player.Name .. "Slime")
		if slime then
			for _, part in pairs(slime:GetChildren()) do
				if part:IsA("BasePart") then
					local sizeMath = size.Value / 100
					part.Size = part.Name == "PrimaryPart" and Vector3.new(sizeMath, sizeMath, sizeMath) or Vector3.new(sizeMath * 0.86, sizeMath * 0.86, sizeMath * 0.86)
					part.Color = Color3.new(profile.Data.Data.SlimeColor.R, profile.Data.Data.SlimeColor.G, profile.Data.Data.SlimeColor.B)
				end
			end
		end
	end)
end)```

And data


local template = require(script.Parent.template)
local profileService = require(game.ServerScriptService.ProfileService)
local manager = require(script.Parent.manager)

local profileStore = profileService.GetProfileStore("production", template) 


local function giveLeaderstats(player: Player)
	local profile = manager.Profiles[player]
	if not profile then return end

	local leaderstats = Instance.new("Folder", player)
	leaderstats.Name = "leaderstats"

	local size = Instance.new("NumberValue", leaderstats)
	size.Name = "Slime Size"
	size.Value = profile.Data.Data.Slime 


	local money = Instance.new("NumberValue", leaderstats)
	money.Name = "Money"
	money.Value = profile.Data.Data.Money

	local level = Instance.new("NumberValue", leaderstats)
	level.Name = "Level"
	level.Value = profile.Data.Data.Level

end


local function playerAdded(player: Player)
	local profile = profileStore:LoadProfileAsync("Player_" .. player.UserId)
	

	profile:AddUserId(player.UserId)
	profile:Reconcile()
	profile:ListenToRelease(function()
		manager.Profiles[player] = nil
		player:Kick("data issue dm me")
	end)

	if player:IsDescendantOf(players) == true then
		manager.Profiles[player] = profile
		giveLeaderstats(player)
	else
		profile:Release()
	end
end

for _, player in ipairs(players:GetPlayers()) do
	task.spawn(playerAdded, player)
end

players.PlayerAdded:Connect(playerAdded)

players.PlayerRemoving:Connect(function(player: Player)
	local profile = manager.Profiles[player]
	if not profile then return end
	profile:Release()
end)```

These are the codes where the infinite yield issues come from.

Experience manager:

local leaderstats = player:WaitForChild("leaderstats")

local xpStat = player:WaitForChild("xpValue")
local xpLbl = script.Parent.Frame.amtHolder.xpAmt
local displayedXp = 0
local targetXp = xpStat.Value

local function formatNumber(number)
	return string.format("%0.0f", number):reverse():gsub("(%d%d%d)","%1,"):gsub(",(%-?)$", "%1"):reverse()
end

xpStat.Changed:Connect(function(newMoney)
	script.Sound:Play()
	targetXp = newMoney
end)

game:GetService("RunService").Heartbeat:Connect(function(deltaTime)
	if displayedXp~= targetXp then
		local increment = (targetXp - displayedXp) * 0.1
		if math.abs(increment) < 1 then
			increment = increment >= 0 and 1 or -1
		end
		displayedXp = displayedXp + increment
		if math.abs(targetXp - displayedXp) < 1 then
			displayedXp = targetXp
		end
		xpLbl.Text = formatNumber(displayedXp) .."/" .. player.xpGoal.Value
	end
end)

Can you also send me the scripts under
game → ServerScriptService → PlayerData → manager
and your template module

Edit: this doesn’t seem like the right category for this conversation. Can you send me the information through messages instead.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.