Why don't working this (error massage : Unable to cast value to Object)

What a simple script. I’d appreciate your help

script.Parent.Parent.ProximityPrompt.Triggered:Connect(function()
	local r = game.ReplicatedStorage.shop.buy
	r:FireClient("sword")

end)

Here is a simple script to do what you want, try running the script, but note that I am unable to test it as I don’t have access to your work. Anyways, I want to remind you that I didn’t write this script in a studio environment, so there’s a possibility that it may not work as intended. Let me know if it’s not worked as intented. If i fixed the issue please make sure to close your support topic by check the solution.

You can also like to support :123: :slight_smile:

Script

script.Parent.Parent.ProximityPrompt.Triggered:Connect(function(plr)
	local r = game.ReplicatedStorage.shop.buy
	r:FireClient(plr, "sword")

end)

Explanation
You need to put the player before, the FireClient method expects a player object as the first argument, not a string. You can read more here : RemoteEvent | Documentation - Roblox Creator Hub

Test place
//

~ @hollaquetalBRUH

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