Hello!
Thank you if you came from my previous scripting support post, another bug occurs right when I fix the 1st one that I don’t know how to fix! Basically, I have a spawn system that spawns a part that is supposed to always spawn at the back of the model, however, if the model changed direction, It does not change with it, and continues to spawn in the same exact location it did before. Is there a solution to this? Here is the code.
local maxwell = script.Parent.Character.maxwell
local ClickDetector = script.Parent.Hitbox.ClickDetector
local replicatedStorage = game:GetService("ReplicatedStorage")
local cash = replicatedStorage:WaitForChild("cash")
local canRun = true
ClickDetector.MouseClick:Connect(function()
if canRun == true then
local newCash = cash:Clone()
local maxwellPosition = maxwell.Position
local cashPosition = maxwellPosition + Vector3.new(4,0,0)
newCash.Position = cashPosition
newCash.Parent = workspace
canRun = false
wait(0.2)
canRun = true
end
end)
If you are able to help out that would be much appreciated!