What I am trying to do
Hey there, I’m trying to create a shop system for my RPG game that I am making. The shop works well, except I have one problem with how it distributes the item the player bought.
The Issue
My issue is that one of the items that are sold, the sword, uses Raycast Hitbox V4 for dealing damage, however when the player buys the item the Raycasts get “stuck” in the air.
It looks like this:
(The shop npc is the character model with my roblox avatar)
I’ve tried debugging the issue, and I think the problem comes with the script that actually distributes the items. Not completely sure tho as I’m not too good at debugging.
Anyways here is the script (that actually distributes it):
game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(function(player, from, toolName, price)
player.leaderstats.Grams.Value -= price
local toolCopy = game.ReplicatedStorage.Items:FindFirstChild(toolName):FindFirstChild(toolName):Clone()
toolCopy:WaitForChild("Handle").Anchored = false
toolCopy.Parent = player.Backpack
end)
Another thing I find weird is that I have another npc that gives out quests and gives the player a reward if they finish it. If I make it so they give the sword as a reward, the raycast hitboxes work for some reason. If you guys need any more context, like the script for interacting with the npc and others just tell me.
I’m not sure if I am just being dumb or something, but any help would be appreciated!