Alright im following multiple tutorials but i did this
function.keydown:connect(function(key))
if (key:byte() == 48) then
Instance.new("Part", workspace)
end
Im new to this stuff so i dont really understand it so any help would be useful.
Alright im following multiple tutorials but i did this
function.keydown:connect(function(key))
if (key:byte() == 48) then
Instance.new("Part", workspace)
end
Im new to this stuff so i dont really understand it so any help would be useful.
Do not use the second argument of Instance.new().
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, processed)
if not processed then
if input.KeyCode == Enum.KeyCode.F -- Change Keycode
local part = Instance.new("Part")
part.Parent = workspace -- Change the parent AFTER
end
end
end)
UserInputService is probably better for this case:
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.A then
Instance.new("Part", workspace)
end
end)
Put a local script in the TextButton and try this:
local tb = script.Parent
tb:MouseButton1Click:Connect(function()
Instance.new("Part", workspace)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.