Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I can not think of what to add to the rest of the script to make it finished. Can Someone Help?

Asked by 7 years ago

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!

1 answer

Log in to vote
0
Answered by 7 years ago

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).

0
This is only a little part of making a tycoon door. The next step would probably be preventing players who aren't the designated player to enter. WingedHorizen201 124 — 7y
0
Your help worked but as you said "The next step would probably be preventing players who aren't the designated player to enter" do you have any idea how I would do that? Cheesepotato999 8 — 7y
Ad

Answer this question