Clone Is Not Working

Hello there, i have a problem with cloning. Before, this script worked, but then it is not working at all. I tried to set CanCollide and Anchored to true in the script, but no result. Clone is not even appearing in Folder or Workspace, no errors in output. Any help will be appreciated :slightly_smiling_face:

local rs = game.ReplicatedStorage
local eventFolder = rs:WaitForChild("Events")
local valueToGive = 1
local PlayerDataHandler = require(game.ServerScriptService:WaitForChild("PlayerDataHandler"))

eventFolder.SpawnCash.OnClientEvent:Connect(function()
	local cash = rs.cash:Clone()
	local cubeposition = workspace.cube.PrimaryPart.Position
	local cashPosition = cubeposition + Vector3.new(0, 3, 0)
	cash.Position = cashPosition
	cash.Parent = workspace:WaitForChild("CashFolder")
	cash.CanTouch = true
	cash.CanCollide = true
	cash.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChildOfClass("Humanoid") then
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			if player then
				PlayerDataHandler:Update(player, "Cash", function(currentCash)
					return currentCash + valueToGive
				end)
			end
		end
	end)
end)

Is it transparent? If it is set the Transparency to 0

No, its not transparent. (wow 3O characters)

Try setting the Parent first to Workspace and then ChasFolder

That would make it more complicated, you dont need to do that. Parenting works fine, just keep it with chasfolder
Can you print out print(cash) to make sure it is not nil?

Oh. I just found out that remotevent is not running

1 Like

:confused: wowww ok. lol

maybe you shouldve worked into it more without making a topic…

yeah, sorry my bad… 9090909090

I had seen that there wasn’t any way to activate the Remote Event, but I just thought “He activates it in some other way probably)

Edit: Not relevant but, is there any way to activate a RemoteEvent from the Server?

of course you didnt see the line where he activates the remote event lol he only sent a server script

1 Like

Another thing besides the problem that you have is that this code has been placed inside the LocalScript, but you are trying to access the ServerScriptService which is only accessible for the server only. I believe it will show some kind of error. If you really want to use that module both on server-side and client-side, please do consider ReplicatedStorage where both clients and servers have access to it.

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