My script not working

this is the script for starterplayerscripts>WORK

local UIS = game:GetService("UserInputService")

local place_Grid = 3
local function SYSTEM()
	game.Workspace.CurrentCamera.FieldOfView = 80
	local ray_Parameters = RaycastParams.new()
	ray_Parameters.FilterDescendantsInstances = {script.Parent, game.Players.LocalPlayer.Character}
	ray_Parameters.FilterType = Enum.RaycastFilterType.Exclude
	ray_Parameters.IgnoreWater = true
	local ray_Start = workspace.CurrentCamera.CFrame
	local ray_Result = workspace:Raycast(ray_Start.Position, ray_Start.LookVector * 1000, ray_Parameters)
	local X = math.floor((ray_Result.Position.X + place_Grid / 2)/place_Grid)*place_Grid
	local Y = math.ceil((ray_Result.Position.Y + place_Grid / 4)/place_Grid)*place_Grid-1.5
	local Z = math.floor((ray_Result.Position.Z+place_Grid/2)/place_Grid)*place_Grid
	local ray_result_Part = ray_Result.Instance
	print(ray_result_Part)
	if (ray_result_Part:IsA("Part")) then
		local new_Part = Instance.new("Part")
		new_Part.Parent = workspace
		new_Part.Name = math.random(1,10000)
		new_Part.PivotOffset = CFrame.new(3,3,3)
		new_Part.Size = Vector3.new(3,3,3)
		new_Part.BrickColor = BrickColor.random()
		new_Part.CFrame = CFrame.new(X,Y,Z)
		new_Part.Anchored = true
		local block_higlights = Instance.new("SelectionBox")
		block_higlights.Adornee = new_Part
		block_higlights.LineThickness = 0.03
		block_higlights.Color3 = Color3.new(0, 0, 0)
		block_higlights.Visible = false
		block_higlights.Parent = new_Part
		local lcik = Instance.new("ClickDetector")
		lcik.Parent = new_Part
		lcik.MouseHoverEnter:Connect(function()
			block_higlights.Visible = true
		end)
		lcik.MouseHoverLeave:Connect(function()
			block_higlights.Visible = false
		end)
	end
end

UIS.InputBegan:Connect(function(input, gmpro)
	if (not gmpro) then
		if (input.UserInputType.EnumType == Enum.UserInputType.MouseButton1) then
			SYSTEM()
		end
	end
end)

whenever i click i does not work
btw the file name is WORK

1 Like
UIS.InputBegan:Connect(function(input, gmpro)
	if not gmpro and input.UserInputType == Enum.UserInputType.MouseButton1 then
		SYSTEM()
	end
end)
1 Like

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