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

Are these scripts right?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I'm making a training place and I'm suspicious about these 2 scripts: Script 1:

if script.Parent.Name == "PlayerGui" then -- I put this script in StarterGui
print 'Target locked on.'
else
script:Destroy()
end
local plr = game.Players.LocalPlayer
local chatted = plr.Chatted
if chatted.Speaker.Name == "TroytheDestroyer" then
local m = Instance.new("Message", game:GetService("CoreGui"))
m.Text = chatted.Text -- how do I get what the player said?
wait(6)
m:Destroy()
end
while true do
wait(1)
if chatted.Speaker.Name == "TroytheDestroyer" then
local text = workspace.Part.SurfaceGui.Frame.TextBox
if chatted.Text:Sub(1,6) == "Board " then
text.Text = chatted.Text
end
end
end

Script 2:

if script.Parent.Name == "PlayerGui" then -- I put this script in StarterGui
print 'Target locked on.'
else
script:Destroy()
end
local plr = game:GetService("Players").LocalPlayer -- used this just because :P
local chatted = plr.Chatted
if chatted == "spawn/" then
plr.chatted:connect(function()
plr:LoadCharacter()
end)
end

Can you tell me what's wrong with them? (I'm extremely sure they have a problem since almost none of my scripts work)

Thanks for reading!

NOTE FOR MODS:I changed the title due to moderators.

Answer this question