如果你不能找到任何free-model,要么你想要做什么,或是可编辑的;在这里,我们去:
因为我们经常引用script.Parent
,让我们做一个variable:
local Block = script.Parent
也让可以避免进行变量也太把像在代码体URL的常量:
local TShirtTexture = "http://www.roblox.com/asset/?version=1&id=1028594"
请注意,T恤纹理链接不同于商品链接。我认为Bloxxer纹理是http://www.roblox.com/asset/?version=1&id=1028594
。为了找到链接,加入游戏工作室与T恤和inspect T恤
我们还需要一个debouncer
然后我喜欢anonymous functions更好,如果你并不真的需要外引用它:
Block.Touched:connect(function(Part)
-- code goes here
end)
线part.Parent:findFirstChild
可能是不安全的part.Parent
可能nil
如果一部分接触之后,但在代码运行之前去除,所以最好先检查一下它(用了一些VIP门打破,如果你拍因为这个)。与其他东西一样,检查它是否存在,否则代码可能会在某些时候中断。
接下来,字符Torso
被大写。此外,T恤是在角色中,而不是玩家。而在一些变量扔
最后都在一起:
-- Put some variables
local Block = script.Parent
local TShirtTexture = "http://www.roblox.com/asset/?version=1&id=1028594"
-- Debounce variable
local Debounce = false
-- Use anonymous function
Block.Touched:connect(function(Part)
-- Assume that the Part is a BodyPart, thus the parent should be the character
local Character = Part.Parent
-- Ensure that our assumption is correct
if Character == nil or Character:findFirstChild("Humanoid") == nil then return end
-- Reference to the assumed Torso
local Torso = Character:findFirstChild("Torso")
-- Ensure that it exists
if Torso == nil then return end
-- Reference to the assumed T-Shirt
local TShirt = Torso:findFirstChild("roblox")
-- Ensure that it exists, and that it is a Decal (T-Shirts are decals)
if TShirt == nil or not TShirt:IsA("Decal") then return end
-- Ensure the texture is correct
if TShirt.Texture ~= TShirtTexture then return end
-- Check debounce
if Debounce then return end
Debounce = true
-- Do stuff
Block.Check.Transparency = 0
wait (2)
Block.Check.Transparency = 1
Debounce = false
end)
如果你要检查,如果玩家拥有的项目,但没有穿它,check this out
而且,如果脚本不起作用,请记住发帖相关errors
我在我的世界尝试它,脚本不工作。我试图改变T恤ID一点,看看是否有错误,但它仍然无法正常工作。 – AirportStaff
@AirportStaff是否有错误? Block.Check是否正确?通常你没有零件 – ZombieSpy
我不知道为什么,但有人编辑我的问题,并添加一个“检查”因为没有在我的第一个问题。但是,无论如何,我删除“检查”,现在它工作! – AirportStaff