You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Roblox触发Proximity Prompt后GUI框架不显示及FireClient调用GUI无响应问题

Roblox GUI显示问题解决

问题根源

你的两个问题都是同一个错误导致的:本地脚本错误地修改了StarterGui而非玩家专属的PlayerGui。

关键错误点

StarterGui是玩家界面的模板,仅在玩家加入游戏时复制到其个人的PlayerGui中。运行时修改StarterGui不会对当前已进入游戏的玩家生效,必须操作玩家自己的PlayerGui才能让界面显示。另外,客户端事件回调不需要传入player参数,客户端脚本可以直接通过game.Players.LocalPlayer获取当前玩家。

修正后的脚本

本地脚本(Local Script)

local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui

game.ReplicatedStorage.Events.OpenLoadout.OnClientEvent:Connect(function()
    playerGui.GunShop.MainFrame.Visible = true
    game.Workspace.LoadoutShop.Prompt.Enabled = false
    print("Test")
end)

服务器脚本(Server Script)

原脚本逻辑没问题,优化命名提升可读性:

local proximityPrompt = script.Parent.Prompt

proximityPrompt.Triggered:Connect(function(player)
    game.ReplicatedStorage.Events.OpenLoadout:FireClient(player)
end)

额外验证项

  • 确认GunShop界面已正确加载到玩家的PlayerGui中(测试时可通过开发者工具查看)
  • 检查ReplicatedStorage.Events.OpenLoadout这个RemoteEvent是否已创建
  • 本地脚本必须放在客户端容器内(如PlayerGui、StarterPlayerScripts、StarterPack),不能放在服务器专属容器(如ServerScriptService)

内容的提问来源于stack exchange,提问作者Blast123b

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 00:05:10