" Expected SpawnLocation got Part for Player:RespawnLocation."

image

local module = {}
	
module.Checkpoint = function(CheckPointPad,stageNumber)
	
CheckPointPad.Touched:Connect(function(hit)
		
		if hit.Parent:FindFirstChild("Humanoid") then
			
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			local Debounce = false
			local character = hit:FindFirstAncestorOfClass("Model")
			
			if player.leaderstats.Stage.Value >= stageNumber then
				
				return
			else
				if Debounce == false then
					Debounce = true
					
					print("StageUp")
					player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
					
					wait(4)
					Debounce = false
				end
				
			end	
			
			if character then
				local Player = game.Players:GetPlayerFromCharacter(character)
				if Player and Player.RespawnLocation ~= CheckPointPad then
					
					local humanoid = character:FindFirstChildOfClass("Humanoid")
					
					if humanoid and humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
						print("SpawnSet")
						Player.RespawnLocation = CheckPointPad
					end
					
				end
			end			
			
			
		end	
	end)
	
	
end

	


return module

image

i don’t know how to fix it

script.Parent is a Part and not a SpawnLocation:
https://developer.roblox.com/en-us/api-reference/class/SpawnLocation

and how i can make player spawn on certain part?

Replace the Part with SpawnLocation is the easiest option, if you knew how to instantiate this. Alternatively, create a custom respawning logic that allows you to place the character anywhere before they appear.

It is

player.RespawnLocation
not
player:RespawnLocation

I think you’ve mistaken: The whole error message was:

Expected SpawnLocation, got Part for Player.RespawnLocation

Wait, something doesn’t seem right. :face_with_raised_eyebrow:

Use a spawnlocation not a part LOL

No, I meant the error message. This error message is full of typos, probably.

No it is the thing look:

I already addressed this issue in a previous reply if you scrolled up. Another issue apparently arised from the error message when it confused the OP from understanding the meaning of this.