i want show billboardguis with text button above ores so it must be in playergui. but idk how to make it. i tryed to make it but i made only working for 1 player:

local function MobileSearch()
	if game:GetService("UserInputService").TouchEnabled == true then
		return true
	else
		return true
	end
end

local mobilemineclone = script.Parent.MobileMineTemplate:Clone()
wait(2)
while wait() do
	if MobileSearch() == true then
		for i,v in pairs(game.Workspace.Ores.Rock:GetChildren()) do
			if not v:IsA("Script") then
				if v:FindFirstChild("MineBGui") then
					if v:FindFirstChild("MineBGui").Value == false then
						v:FindFirstChild("MineBGui").Value = true
						mobilemineclone.Parent = script.Parent
						mobilemineclone.Name = "MobileMine"
						mobilemineclone.Adornee = v
					end
				end
			end
			wait(0.02)
		end
	end
	wait(0.1)
end

this is script for placing ores when join:

wait(3)
local rock = script.Parent.Rock

local rockLocations = game.Workspace.Ores.RockLocations:GetChildren()
local numLocations = #rockLocations
local HPFolder = rock.Parent.Parent["0 HP of ores"]

for place = 1, numLocations - 2 do
	local rockClone = rock:Clone()
	rockClone.Parent = script.Parent
	rockClone.Position = rockLocations[place].Position
	rockClone.Size = rockLocations[place].Size
	rockClone.Orientation = rockLocations[place].Orientation
	rockLocations[place].Free.Value = false
	rockClone.Health.TextOfHP.Text = "   "..HPFolder.StoneHP.Value.."/"..HPFolder.StoneHP.Value.."   "
end

rock:Destroy()

this is mining and respawn after mine:

local label = script.Parent.Health
local rock = script.Parent
local hit_sound = rock.Hit
local rockLocations = game.Workspace.Ores.RockLocations:GetChildren()

local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ServerStorage = game:GetService('ServerStorage')
local HPFolder = rock.Parent.Parent["0 HP of ores"]
local swingsLeft = 1000

script.Parent.MineEvent.OnServerEvent:Connect(function(player)
	for i,v in pairs(game.ReplicatedStorage.Toolls:GetChildren()) do
		if player.Character:FindFirstChild(v.Name) then
			local distance = (player.Character.HumanoidRootPart.Position - script.Parent.Position).magnitude
			if distance <= player.Character:FindFirstChild(v.Name).Range.Value then
				hit_sound:Play()
				swingsLeft -= player.Character:FindFirstChild(v.Name).Damage.Value
				label.Green.Size = UDim2.new(swingsLeft/HPFolder.StoneHP.Value, 0, 1, 0)
				label.TextOfHP.Text =  "   "..swingsLeft.."/"..HPFolder.StoneHP.Value.."   "
				if swingsLeft <= 0 then
					local currentPos = rock.Position
					local currentPlace = nil
					for _, place in pairs(rockLocations) do
						if currentPos == place.Position then
							currentPlace = place
							break
						end
					end
					for _, place in pairs(rockLocations) do
						if place.Free.Value == true then
							rock.Position = place.Position
							rock.Orientation = place.Orientation
							rock.Size = place.Size
							place.Free.Value = false
							break
						end 
					end

					if currentPlace then
						currentPlace.Free.Value = true	
					end
					swingsLeft = HPFolder.StoneHP.Value
					label.Green.Size = UDim2.new(1, 0, 1, 0)
					label.TextOfHP.Text =  "   "..swingsLeft.."/"..HPFolder.StoneHP.Value.."   "

					--New End
					local rocks = ReplicatedStorage:FindFirstChild("Ores"):FindFirstChild("Stone"):GetChildren()
					local stone = rocks[math.random(1,#rocks)]:Clone()
					stone.Parent = game.Workspace
					stone.Position = currentPos
					local collectscript = ServerStorage:FindFirstChild("Collect"):Clone()
					collectscript.Parent = stone
				end
			end
		end
	end
end)

local function onTouch(otherPart)
	local tool = otherPart.Parent
	if tool:IsA('Tool') and tool.Mining.Value == true then
		hit_sound:Play()
		swingsLeft -= tool.Damage.Value
		label.Green.Size = UDim2.new(swingsLeft/HPFolder.StoneHP.Value, 0, 1, 0)
		label.TextOfHP.Text =  "   "..swingsLeft.."/"..HPFolder.StoneHP.Value.."   "
	end
	if swingsLeft <= 0 then
		
		--New Start
		local currentPos = rock.Position
		local currentPlace = nil
		for _, place in pairs(rockLocations) do
			if currentPos == place.Position then
				currentPlace = place
				break
			end
		end
		for _, place in pairs(rockLocations) do
			if place.Free.Value == true then
				rock.Position = place.Position
				rock.Orientation = place.Orientation
				rock.Size = place.Size
				place.Free.Value = false
				break
			end 
		end
		
		if currentPlace then
			currentPlace.Free.Value = true	
		end
		swingsLeft = HPFolder.StoneHP.Value
		label.Green.Size = UDim2.new(1, 0, 1, 0)
		label.TextOfHP.Text =  "   "..swingsLeft.."/"..HPFolder.StoneHP.Value.."   "

		--New End
		local rocks = ReplicatedStorage:FindFirstChild("Ores"):FindFirstChild("Stone"):GetChildren()
		local stone = rocks[math.random(1,#rocks)]:Clone()
		stone.Parent = game.Workspace
		stone.Position = currentPos
		local collectscript = ServerStorage:FindFirstChild("Collect"):Clone()
		collectscript.Parent = stone
	end
end

rock.Touched:Connect(onTouch)

2 comments

0

Your doing it wrong. Just add a Billboard gui in side the StarterGui and disable it so they wont see it in default. Now if their arrow went over the ore then you enable the billboard gui and set its adornee to the ore. The saves doenst it?

0

use local script when ur making the adornee visible btw just sayin