Issues with Cloning and Stats Display

So my friend and I were testing out my game but we encountered 2 main issues.


As you can see for me, my stats show but his doesn’t and for him his stats shows but doesn’t for me. Another issue is that the heads that get cloned don’t show on any screen except the player controlling the character. What is happening?

2 scripts for cloning heads and selling are in StarterCharacterScripts and are local scripts.

Selling: (The leaderstats script is in ServerScriptService it’s just this one sell script that’s in a local script)

local player = game.Players.LocalPlayer
local plr = player.Character

local folder = plr:FindFirstChild("headContainer")

local function sell()
	player.leaderstats.Money.Value = --converting rate here
	player.leaderstats.Heads.Value = -- just taking away values
end

part.Touched:Connect(sell)

Clone Script:

UserInputService.InputBegan:Connect(function(input)
	local leaderstats = plr:WaitForChild("leaderstats")
	local h = leaderstats:WaitForChild("Heads")
	
	local e = plr:WaitForChild("mf")
	local m = e:WaitForChild("headMultiplier")
	
	local function clicked()
		h.Value += 1 * m.Value

		local cloned = head:Clone()
		cloned.Parent = headFolder
		cloned.Position = head.Position + Vector3.new(0, 1*h.Value, 0)
	end
	-- there is a part after this that uses clicked()
	
end)

(Some parts are missing as they are not as important)

2 Likes

I recommend making it a server script since local scripts run things that only the client can see…
Also, use PlayerAdded This event will fire when a player joins the game. This can also be used to load the player’s saved data to the game.

3 Likes

Use RemoteEvent to make them work in server. that’s why other player can’t see the stats and heads because it only replicate via Local.

1 Like

Do I place this script in ServerScriptStorage or StarterCharacterScripts? When I modified my script and placed it in ServerScriptStorage, I wasn’t able to do things with the players head.

place it in serverscriptservice

could you send me the script, let me me modify it…

The problem with that is it won’t let me access the character’s head.

Part of the local script that handles cloning the head is already up there.

Yes. For some reason it keeps giving me an error even though I referenced the head correctly.

I know what you’re talking about but the problem is I don’t know exactly what you did on the script since you said you weren’t able to do things with the players head so let me modify the script and fix the players head problem you’re talking about

using local scripts for leaderstats isn’t the best way

@dummycide yep, there is your solution

Leaderstats is in a different script in ServerScriptService

then why are you also using a local script for the leaderstats?

Only the sell script is a local script for leaderstats.

Why are you also using userinputservice?

You didn’t show all the scripts you used for the leaderstats so some people are gonna get confused in this topic…

Because for the game to work, a player needs to tap or click on the screen for them to get their head cloned.

I recommend making it a server script, maybe that will work.

Dude, Server script is a safer way. You should also use remote events for the selling stuff to work…