Im curious to know why I am getting the error "Unable to cast value to Object"

because i am dead certain this value is NOT equal to nil

my function looks alright

local function handleClick(player, clickPart, pass)
	local slaps = player.leaderstats.Slaps
	local slapAMT = clickPart:FindFirstChild("Cost")
	local gloveName = clickPart:FindFirstChild("Glove")

	if MS:UserOwnsGamePassAsync(player.UserId, pass) then
		local hand = clickPart.Parent.Default.Hand
		local Y = hand.Success
		local Y2 = hand.Success2
		local Y3 = hand.Success3
		local L = hand.SLight
		local Sound1 = hand.Select

		player.leaderstats.Glove.Value = gloveName.Value
		Sound1:Play()
		Y.Enabled = true
		Y2.Enabled = true
		Y3.Enabled = true
		L.Enabled = true
		wait(0.38)
		Y.Enabled = false
		Y2.Enabled = false
		Y3.Enabled = false
		L.Enabled = false
	else
		local hand = clickPart.Parent.Default.Hand
		local N = hand.Rejected
		local N2 = hand.Rejected2
		local Sound2 = hand.No

		N.Enabled = true
		N2.Enabled = true
		Sound2:Play()
		print(pass)
		print(player.UserId)
		MS:PromptPurchase(player.UserId, pass)
		wait(0.38)
		N.Enabled = false
		N2.Enabled = false
	end

end

and where i am calling this function

clickDetector.MouseClick:Connect(function(player)
		handleClick(player, clickPart, standData[7])
	end)

and the module i am finding “standData” in

local abilityButton = "Press E/Ability Button to use"

local StandInfoGamepass = {
	-- Format: {name, power, speed, ability, abilityType, gamepassinformation, gamepassid}
	{"OVERKILL", 50, 0.2, "hot touch", "Passive", "PW2 Bundle", 172575975},
	{"Vengeance", 50, 0.2, "over kill", "Passive", "PW2 Bundle", 172575975},
}

return StandInfoGamepass

if anyone can see an issue please let me know

1 Like

i’m gonna be honest man, i don’t know if i can help with this BUT

you’ve gotta be more specific, send entire scripts, send variables and so on

MarketPlaceService.PromptPurchase takes a Player Instance as the first parameter, not the player’s user ID.

Oh really?
let me try grabbing the player

1 Like

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