Roblox物体拾取问题

huangapple go评论91阅读模式
英文:

roblox object pick up issue

问题

我在Roblox Studio中遇到了麻烦,当我点击物体时,会导致用户飞行或悬浮... 这是我的代码

local FrenchFries = script.Parent
local click = FrenchFries.ClickDetector

local function pickup(player)
	local newTool = Instance.new('Tool')
	newTool.Name = 'FrenchFries'
	local handle = FrenchFries:Clone()
	handle.Name = 'Handle'
	handle.Parent = newTool
	handle.Script:Destroy()
	newTool.Parent = game.Workspace:FindFirstChild(player.Name)
end

click.MouseClick:Connect(pickup)

我期望物品能被拾取并持有。

英文:

im having trouble picking up an item in roblox studio, when i click the object, it causes the user to fly or levitate... here s my code

local FrenchFries = script.Parent
local click = FrenchFries.ClickDetector

local function pickup(player)
local newTool = Instance.new('Tool')
newTool.Name = 'FrenchFries'
local handle = FrenchFries:Clone()
	handle.Name = 'Handle'
	handle.Parent = newTool
	handle.Script:Destroy()
	newTool.Parent = game.Workspace:FindFirstChild(player.Name)

end

click.MouseClick:Connect(pickup)`

im expecting the item to be picked up and held`

答案1

得分: 0

解除工具或其零件的固定,并将它们与物体和工具连接起来,以防它们只是掉下来。问题在于,您固定了工具或其零件之一,这会将物体放置在放入工作区并将玩家发送到那里时的位置。在Roblox中,有些物体无法解除固定,就像脚本一样。

英文:

Unanchor the tool or it's parts and add wields to the object and the tool so they don't just fall. The issue was that you have the tool or one of it's parts anchored which places the object to where it was when you put it in workspace and send the player there. Some objects in Roblox, you can't unanchor them like a script.

huangapple
  • 本文由 发表于 2023年5月25日 23:03:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76333749.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定