Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help with local parts when cloning a meshpart, what is wrong? (SOLVED)

Asked by
xsodar 19
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"

1local part = game.Lighting.DiamondGem:Clone()
2 
3part.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:

01collect = true
02 
03game.Workspace.DiamondGem.Touched:Connect(function(hit)
04 
05    local humanoid = hit.Parent:FindFirstChild("Humanoid")
06 
07    if humanoid ~= nil and collect == true then
08        collect = false
09 
10    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
11 
12 
13    wait(0.2)
14    game.Workspace.DiamondGem.Transparency = 1
15 
View all 23 lines...

This script works when I'm not using "Clone". But when I do this stops working. Anyone knows how to fix this?

Thanks

1
Don't use Lighting as storage - that's not what it's for. SummerEquinox 643 — 6y

Answer this question