【问题标题】:Roblox, Dont change text and Image dont changeRoblox,不要更改文本和图像不要更改
【发布时间】:2022-10-05 12:57:57
【问题描述】:

我在更改图像和文本时遇到问题,这是脚本:

--Image Change(localScript)
local Player = game:GetService("Players")

local player = game.Players.LocalPlayer
local imageLabel = script.Parent.Parent.ImageTag
local userID = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420

local content, isReady = Player:GetUserThumbnailAsync(userID, thumbType, thumbSize)

while wait() do
    imageLabel.Image = content
end

--Text Change(localScript)

local textLabel = script.Parent.Parent.NameTag

local player = game.Players.LocalPlayer

while wait() do
    textLabel.Text = player.Name
end
--Passport Clone(Script)

local passport = game.ReplicatedStorage.Passport

game.Players.PlayerAdded:Connect(function(plr)
    if plr:IsInGroup(14472135) then
        local passportClone = passport:Clone()
        passportClone.Parent = game.StarterPack
    end
end)

当护照被克隆时,我可以看到我的名字和图像,但其他玩家什么也看不到。

任何建议谢谢

【问题讨论】:

  • 问题是什么?你期望会发生什么?实际发生了什么?你得到什么错误?
  • 问题是我没有错误当护照生成时文本不会改变,图像不会改变,我不明白为什么要制作本地脚本?谢谢

标签: lua scripting roblox


【解决方案1】:

我认为您的问题是图像和文本仅针对拥有护照的玩家而不是其他玩家更改。如果是这样,您只需要更改两个脚本:Image Change 和 Text Change。

这是我认为应该适用于脚本的内容。

图像变化

--Image Change(Script)
    game.Players.PlayerAdded:Connect(function(player)
        local Player = game:GetService("Players")
    
    
        local imageLabel = script.Parent.Parent.ImageTag
        local userID = player.UserId
        local thumbType = Enum.ThumbnailType.HeadShot
        local thumbSize = Enum.ThumbnailSize.Size420x420
        
        local content, isReady = Player:GetUserThumbnailAsync(userID, thumbType, thumbSize)
    
        while wait() do
            imageLabel.Image = content
        end
    end)

文本更改

  --Text Change(Script)
    game.Players.PlayerAdded:Connect(function(player)
        local textLabel = script.Parent.Parent.NameTag
    
        while wait() do
            textLabel.Text = player.Name
        end
    end)

让我知道这些是否不起作用,但它们应该起作用。

希望我有所帮助!

【讨论】:

    猜你喜欢
    • 2011-09-02
    • 1970-01-01
    • 2011-11-12
    • 2020-06-23
    • 1970-01-01
    • 2021-07-12
    • 1970-01-01
    • 2019-03-28
    • 2010-11-26
    相关资源
    最近更新 更多