I'm trying to make it so that whenever touch pad is touched, the script finds the players name and assigns it to the Owner StringValue and then prints the owners name. So far it prints the owners name, however the Owner StringValue remains unchanged. What am I doing wrong?
local touchpad = Tycoon.Entrance.touchpad
local owner = game.Workspace.Tycoon.Owner.Value
local function steppedOn(part)
local player = part.Parent
if game.Players:GetPlayerFromCharacter(player) then
local player = game.Players:GetPlayerFromCharacter(player)
owner = player -- Supposed to make the Owner.Value equal to the player
print(owner)
end
end
touchpad.Touched:connect(steppedOn)
Thanks

4 comments
but you didnt really answer his question: "How do you change the value of a variable outside of your script?"
But his commented line 8 points out the problem.
well yeah, i guess.
Thanks! This helped me get the solution