Hello.
I’m having a problem on deciding how to make this work. So basically, this “entity” teleports a player when that player chats a specific word in the chat box. After that, I want the player to not be able to talk until they reset. How would I go on achieving this? I want to use SetCoreGuiEnabled but I am not sure how to implement it into the script.
Here is my server script:
local triggerwords = {"SCP2521", "SCP-2521", "2521", "2 5 2 1", "SCP 2521", "Twenty Five Twenty One", "Two Five Two One","TwoFiveTwoOne", "TwentyFiveTwentyOne", "TwoThousandFiveHundredTwentyOne", "Two Thousand Five Hundred Twenty One"} --table of trigger words
local Occupied = false
function clone()
local SCP2521 = game.ServerStorage.SCP2521:Clone()
SCP2521.Parent = game.workspace
end
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
for i = 1, #triggerwords do --I don't know how to use ipairs and pairs
local word = triggerwords[i]
local matchcheck = string.match(msg, word)
if matchcheck ~= nil and Occupied == false then
Occupied = true
if word == "SCP2521" or "SCP-2521" or "2521" or "2 5 2 1" or "SCP 2521" or "Twenty Five Twenty One" or "twenty five twenty one" or "Two Five Two One" or "two five two one" or "TwoFiveTwoOne" or "twofivetwoone" or "TwentyFiveTwentyOne" or "TwoThousandFiveHundredTwentyOne" or "Two Thousand Five Hundred Twenty One" then
local victim = plr.Character
clone()
victim.Humanoid.WalkSpeed = 0
victim.HumanoidRootPart.Anchored = true
wait(math.random(2,5))
workspace.SCP2521.PlayAnimation.Disabled = false
workspace.SCP2521.HumanoidRootPart.CFrame = victim.HumanoidRootPart.CFrame
local Scream = workspace.SCP2521.Head.Scream
wait(3.04)
victim.HumanoidRootPart.CFrame = workspace.SCP2521.TakenSpot.CFrame
wait(1.01)
Scream:Play()
wait(.2)
victim.HumanoidRootPart.CFrame = workspace.TeleportPartToGlitchedReality.CFrame
victim.HumanoidRootPart.Anchored = false
victim.Humanoid.WalkSpeed = 7.5
workspace.SCP2521:Destroy()
wait(1)
Occupied = false
end
end
end
end)
end)