9мес



Программирование
+2Object Spawn in front of player (ROBLOX)
Делаю игру, похожую на Garry's Mod. Но спавн объектов перед игроком не работает, может ошибка в коде?
script.Parent.MouseButton1Click:connect(function(GetCar)
Mod = game.ServerStorage.Gman
local Gman = Mod:clone()
Gman.Parent = workspace
Gman:MoveTo(player.Character.Torso.Position + Vector3.new (0, 0, 20))
end)
script.Parent.MouseEnter:Connect(function()
script.Parent.SpawnName.Visible = true
script.Parent.MouseLeave:Connect(function()
script.Parent.SpawnName.Visible= false
end)
end)
По дате
По рейтингу
123456789101112131415161718192021222324252627282930313233
-- Используйте событие Click вместо MouseButton1Click
script.Parent.MouseButton1Click:Connect(function()
-- Получите игрока
local player = game.Players.LocalPlayer
if not player or not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") then
warn("Player or HumanoidRootPart not found")
return
end
-- Получите объект из ServerStorage
local Mod = game.ServerStorage:FindFirstChild("Gman")
if not Mod then
warn("Gman not found in ServerStorage")
return
end
-- Клонируйте и поместите объект в Workspace
local Gman = Mod:Clone()
Gman.Parent = workspace
-- Переместите объект перед игроком
Gman.Position = player.Character.HumanoidRootPart.Position + Vector3.new(0, 0, 20)
end)
-- Обновите отображение SpawnName при наведении курсора
script.Parent.MouseEnter:Connect(function()
script.Parent.SpawnName.Visible = true
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.SpawnName.Visible = false
end)
12345
script.Parent.MouseButton1Click:Connect(function()
local Gman = game.ServerStorage.Gman:Clone()
Gman.Parent = workspace
Gman:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -20))
end)
dd
123456789101112131415
script.Parent.MouseButton1Click:Connect(function()
local Mod = game.ServerStorage.Gman
local Gman = Mod:Clone()
Gman.Parent = workspace
local player = game.Players.LocalPlayer
Gman:MoveTo(player.Character.Torso.Position + Vector3.new(0, 0, 20))
end)
script.Parent.MouseEnter:Connect(function()
script.Parent.SpawnName.Visible = true
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.SpawnName.Visible = false
end)
Че
Больше по теме