I've been fondling and playing around with roblox Lua lately, and I decided to create a text button that, when pressed, creates a part.
however.... everything seems to be functioning but I don't see any parts being created.
There are two scripts.
a local script inside the button;
local players = game:GetService("Players")
local player = players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local Button = player.PlayerGui:WaitForChild("CreatePartButton")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage:WaitForChild("CreatePartEvent")
local function CreatePart()
createPartEvent:FireServer(BrickColor.Green(), Vector3.new(0, 20 , 0))
end
Button.MouseButton1Click:Connect(CreatePart)
and a script in replicated storage;
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "CreatePartEvent"
local function onCreatePartFired(player)
print(player.Name, "wants to create a part")
local newPart = Instance.new("Part")
newPart.BrickColor = color
newPart.Position = position
newPart.Parent = game.Workspace
end
createPartEvent.OnServerEvent:connect(onCreatePartFired)

1 comment
You've been fondling and playing around?