Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 " 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

✓ Accepted answer

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

2 comments

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.

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?

This discussion is preserved as it was. New answers, comments, and votes are closed.