Hey guys, so I’m currently working on an fps, but I have an issue with the textlabel that is suppose to show the name of the gun. It updates but doesn’t show. Let me show you so it’s more clear.
Anyone ever had this problem?
Hey guys, so I’m currently working on an fps, but I have an issue with the textlabel that is suppose to show the name of the gun. It updates but doesn’t show. Let me show you so it’s more clear.
Anyone ever had this problem?
I’m guessing it has a script, can you show it?
yes, here is a part of the script @BirdieI90 :
run.RenderStepped:Connect(function()
if framework.viewmodel and framework.module then
game.StarterGui.HUD.GunName.GunName.Text = framework.module.gunName
end
end)
so framework is a table and viewmodel is the gun in hand, module is a module script with the gun settings. Here is the module for the glock 17 :
local Settings = {
-- SETTINGS --
canAim = true;
aimSmooth = .3;
fireRate = .1;
gunName = "GLOCK 17";
magCapacity = 17;
ammoInMag = 17;
ammoOnYou = 40;
-- ANIMS --
fireAnim = nil;
equipAnim = nil;
-- SOUNDS --
fireSound = game.ReplicatedStorage.Viewmodels.Sounds["GLOCK-17"].Fire;
reloadSound = game.ReplicatedStorage.Viewmodels.Sounds["GLOCK-17"].Reload;
}
return Settings
Is this in a local script or a server script?
You are changing the label in StarterGui. You should change it for the player not the one in StarterGui.
The gui in the player is located in Player.PlayerGui. If you edit the one in the StarterGui, you would be changing the GUI that will be given to new incoming players, not the one the player is using
localscript in starterplayerscript
really? Bruh I didn’t know that haha
Yup, in order to change the text of the gui the player has, look for it in Players.Player.PlayerGui. By using a RemoteEvent or directly edit it.
Oh yeah you’re right it works thanks!
You should change the text on the player’s client via. game.Players.LocalPlayer.PlayerGui
.
run.RenderStepped:Connect(function()
if framework.viewmodel and framework.module then
game.Players.LocalPlayer.PlayerGui.HUD.GunName.GunName.Text = framwork.module.gunName
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.