Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this script work testing it in edit mode but not publish mode?

this dig tool works 100% fine when i test in edit mode but then when i publish it, it dosnt work. I don't see whats wrong. please help. thanks

bin = script.Parent
halt = false

function onButton1Down(mouse)
	local hit = mouse.Target

	if (hit == nil) or (halt == true) then return end
	halt = true
	mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
	bin.Ping:play()
	
	if (hit.Name == "Rock") then
				while hit.Transparency <= 1 do
				hit.Transparency = hit.Transparency + 0.2
				wait(0.7)
				end

			wait(0.7)
			hit.Parent = nil
	end
	
	if (hit.Name == "Dirt") then
				while hit.Transparency <= 1 do
				hit.Transparency = hit.Transparency + 0.2
				wait(0.10)
				end

			wait(0.10)
			hit.Parent = nil
	end
	
	if (hit.Name == "LooseRock") then
				while hit.Transparency <= 1 do
				hit.Transparency = hit.Transparency + 0.2
				wait(0.30)
				end

			wait(0.50)
			hit.Parent = nil
	end

	wait(0.10)
	halt = false
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
end


function onSelected(mouse)
	--print("Action Tool Selected")
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

3 comments

0

Please Help Me.

0

This wont get fixed if no one helps.

0

Is this a server script? Only local scripts run inside the Player.

1 answer

✓ Accepted answer

Assure that you're using a LocalScript object as opposed to a server-sided Script. PlaySolo runs all scripts on the client, meaning that you need to make it run client-side in-game.

3 comments

0

What does make it run client-side in-game mean?

0

Omg, thank you. I switched the Script to a LocalScript and it fixed it, thank you sooo much

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.