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

'fired 1' fires but not 'fired 2'?

local player = script.Parent.Parent
local mouse = player:GetMouse()
local dirt = game.ServerStorage.DirtBlock:Clone()
-- Surface Values
local right = 0
local top = 1
local back = 2
local left = 3
local bottom = 4
local front = 5
--
mouse.Button1Down:connect(function()
	local t = mouse.Target
	print'fired 1'
	if mouse.TargetSurface == front then
		print'fired 2'
		dirt.Parent = workspace
		dirt.Position = t.Position + Vector3.new(3,0,0)
	end
end)

3 comments

0

Try comparing to "Enum.NormalId.Front" rather than a variable named "front"

0

line 12 is a comment

0

It just appears like that because of the website. It's not a comment in the actual script.

1 answer

Why are you checking if the targetsurface is a number value? Shouldn't it be a surface type such as "Front" or "Top"?

3 comments

0

TargetSurface is a NormalId, which is always a number value if you look at the wiki page.

0

Use comments

0

Ah, just assumed it was a string. Didn't bother checking on my phone

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