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

How to put a player's name in a string value?

Asked by 3 years ago
local ballcarrier = script.Parent
local Ball = game.Workspace:FindFirstChild("Handle")

ballcarrier.Value = Ball.Parent.Parent

I have a string value named ballcarrier in replicated storage, inside of it is this script. Ball is a tool and I'm trying to make it so it gets the player's name and puts it in the string value.

0
Well how are you planning on find the player? When the tool is used? Or just automatically?... Galaxybombboy 134 — 3y
0
It'd be when the player is holding the tool NortonHDD 21 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Ok so, put a script in the tool, then put this:

local StringVal = game.ReplicatedStorage.StringVal --put your string value here
script.Parent.Equipped:Connect(function()
    StringVal.Value = script.Parent.Parent.Name.. "'s ball"
end)

thats it, tell me if there is any problems.

0
Thank you! I've been stumped on this for about 2 days, appreciate the help. NortonHDD 21 — 3y
Ad

Answer this question