Basic mining system not working

Hello developers,
I have been working on a very basic mining system using proximity prompts,
when the player triggers the proximity prompt, the part will disappear into the server storage.

When I test the script, this appears in the output: Part is not a valid member of Workspace “Workspace”

here is my script:

game.Workspace.Part = script.Parent

game.Workspace.Part.ProximityPrompt.Triggered:Connect(function(playerWhoTriggered: Player) 
		
	game.Workspace.Part.Parent = game.ServerStorage		
	
		
	end)

If anyone could help me I would be extremely grateful.

I just tested this in studio and it worked fine.

image

--> Get Server Storage
local ServerStorage = game:GetService("ServerStorage")

--> Get The Part
local Part: BasePart = workspace:WaitForChild("Part", 1)

--> Get The Prompt
local Prompt: ProximityPrompt = Part:WaitForChild("Mine", 1)

--> Detect Prompt Triggered
Prompt.Triggered:Connect(function(player: Player)
	print(player.Name .. " Has Mined The Part")
	Part.Parent = ServerStorage
end)
1 Like

Ok, thank you for replying. I will try the script now.

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