Need help with local parts when cloning a meshpart, what is wrong? (SOLVED)
Asked by
6 years ago Edited 6 years ago
I have a problem when I clone my meshpart from lighting to workspace, then all the scripts in my meshpart just stop working.
The thing is that I want to make a meshpart that only disappear for the person who touches it.
So I made a localscript in "StarterGui"
1 | local part = game.Lighting.DiamondGem:Clone() |
3 | part.Parent = game.Workspace.CurrentCamera |
The cloning works but not my other scripts that are in the meshpart (DiamondGem).
The scripts in my meshpart is just normal scripts.
Here is one of the scripts:
03 | game.Workspace.DiamondGem.Touched:Connect( function (hit) |
05 | local humanoid = hit.Parent:FindFirstChild( "Humanoid" ) |
07 | if humanoid ~ = nil and collect = = true then |
10 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
14 | game.Workspace.DiamondGem.Transparency = 1 |
17 | player.leaderstats.Diamond.Value = player.leaderstats.Diamond.Value + 1 |
19 | game.Workspace.DiamondGem.Transparency = 0.4 |
This script works when I'm not using "Clone".
But when I do this stops working.
Anyone knows how to fix this?
Thanks