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

how do i make a text box transfer to a string value?

Asked by 4 years ago

so i think i'm on the right track but this is confusing me

x = game.Workspace.Baseplate

player = script.Parent.Parent.TextBox.Value.Value

function clear()
    if player == player then 
        --some code here
end

script.Parent.MouseButton1Click:Connect(clear)

what i want is to make this select a player by typing it into the box and then i can kill that player, i don't need a kill script i just need to know how to make this work. sorry if this didn't make sense. thanks for reading.

2 answers

Log in to vote
1
Answered by
3wdo 198
4 years ago
x = game.Workspace.Baseplate

player = script.Parent.Parent.TextBox.Value -- you put value.value

function clear()
    if player == player then 
        --some code here
end

script.Parent.MouseButton1Click:Connect(clear)
0
well maybe the stringvalue is called "value" bluzorro 417 — 4y
Ad
Log in to vote
0
Answered by
Elixcore 1337 Moderation Voter
4 years ago
Edited 4 years ago
script.Parent.MouseButton1Click:Connect(function() -- connect to event
player = game.Players:FindFirstChild(script.Parent.Parent.TextBox.Text) -- try to find the player with the name specified in the textbox

    if player then -- check if player exists
    player.Character:BreakJoints() -- kill player
    end
end)

Oh yeah by the way this won't work cos of a few reasons.

If this is a localscript, you cannot kill other players. if this is a serverscript, you cannot see the text changed by the client, or connect to the event.

Answer this question