Hi, I am fairly new to Lua and I am making a tycoon as my first project and currently I am scripting the Entrance so far if you touch it, it will turn slightly transparent and will let you walk past but my problem is that the Humanoid's text is still "Touch to Claim Tycoon!". I want it so that when you touch the door it will change to "<player names> Tycoon" and I just can't figure out how to do that, here is the code for the script called "GateControl" :
script.Parent.Head.Touched:connect(function(part) local door = script.Parent.Head local hum = part.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(part.Parent) if hum ~= nil and player ~= nil then door.Transparency = .5 door.CanCollide = false end end)
If anyone could provide me with a good answer that I will be able to understand it will be very appreciated. Thanks!
I'm not sure if I can help, but I will try my best.
So, currently, you don't have any code to modify the text after the door
is touched.
So, here is my suggestion that you should add to the function:
if hum ~= nil and player ~= nil then -- door.Transparency = .5 -- door.CanCollide = false script.Parent.Name = player.Name .. "'s Tycoon" end
So what I am doing here is that I just changed the name of the parent model, which changes the name of the text (since you are using a humanoid for the text).