You can write your topic however you want, but you need to answer these questions:
-
I’m making game wher you can place pixels, pixels takes a clone of a frame.
-
I use a module script for placing pixels and there is a value for color but doesn’t matter what’s the color it make it always black.
-
I checked here and nothing worked i changed lines and it still doesn’t work
I use local script to use module script functions. I use mouse is “Button1Down” function.
local place = {}
function updatePixelColor(imageLabel, x, y, color)
local imageRectSize = imageLabel.Size
local u = x / (imageRectSize.X.Scale * imageLabel.AbsoluteSize.X)
local v = y / (imageRectSize.Y.Scale * imageLabel.AbsoluteSize.Y)
local pixelX = u * imageLabel.AbsoluteSize.X
local pixelY = v * imageLabel.AbsoluteSize.Y
local pixelFrame = game.ReplicatedStorage.Pixel:Clone()
pixelFrame.Position = UDim2.new(0, pixelX, 0, pixelY)
pixelFrame.BackgroundColor3 = color
pixelFrame.Parent = imageLabel
end
function place.onPixelPlaced(player, x, y, color)
local canvasImage = player.PlayerGui.GUI.Pixels
color = Color3.new(player.OnColor.Value)
updatePixelColor(canvasImage, x, y, color)
end
return place
--This is for module script
local Player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local PlayerGUI = Player.PlayerGui
local Place = require(script.Place)
Mouse.Button1Down:Connect(function(plr)
local OnColor = Player:WaitForChild("OnColor")
local x = Mouse.X - (1.2)
local y = Mouse.Y + (35)
Place.onPixelPlaced(Player, x, y)
local frames = Player.PlayerGui.GUI.Pixels:GetChildren()
print(Player.Name .." placed a pixel to ".."x:" .. x .. " y:" .. y .. " Color is:" .. OnColor.Value .. " Total pixels: " .. #frames)
end)
--And this is for the local script