So im trying to make a florida jit script where when you talk it spits, but i want the spit to last how long the words are, so if its a long sentence, you spit longer than usual, if its a single word or something, its shorter, anyway to do that?
game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(m)
m = m:lower()
if m == "jit" then
local Spit = game.ReplicatedStorage.spit:Clone()
Spit.Parent = game.Workspace
Spit.Position = p.Character.Head.Position
local Chamber = p.Character.Head
Spit.CanCollide = false
Spit.CFrame = Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
Spit.Velocity = Chamber.CFrame.lookVector * 20 + Vector3.new(math.random(5,5),10,math.random(5,5))
Spit.RotVelocity = Vector3.new(0,200,0)
wait(0.1)
local Spit = game.ReplicatedStorage.spit:Clone()
Spit.Parent = game.Workspace
Spit.Position = p.Character.Head.Position
local Chamber = p.Character.Head
Spit.CanCollide = false
Spit.CFrame = Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
Spit.Velocity = Chamber.CFrame.lookVector * 20 + Vector3.new(math.random(5,5),10,math.random(5,5))
Spit.RotVelocity = Vector3.new(0,200,0)
end
end)
end)
Im trying to make it so it says it when jit it said in any part of the sentence, and if it is part of the sentence it spits for as long as the sentence goes for
Alrighty then, have you tried using string.gsub() for returning back an amount of letters & string.find() so that you don’t have to check if the message is only equal to jit?
game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(m)
m = m:lower()
if string.find(m, "jit") then
local iLetters = string.gsub(m, "i")
local tLetters = string.gsub(m, "t")
local FinalResult = iLetters + tLetters
local Spit = game.ReplicatedStorage.spit:Clone()
Spit.Parent = game.Workspace
Spit.Position = p.Character.Head.Position
local Chamber = p.Character.Head
Spit.CanCollide = false
Spit.CFrame = Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
Spit.Velocity = (Chamber.CFrame.lookVector * 10 + Vector3.new(math.random(5,5),10,math.random(5,5))) * FinalResult
Spit.RotVelocity = Vector3.new(0,200,0)
wait(0.1)
local Spit = game.ReplicatedStorage.spit:Clone()
Spit.Parent = game.Workspace
Spit.Position = p.Character.Head.Position
local Chamber = p.Character.Head
Spit.CanCollide = false
Spit.CFrame = Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
Spit.Velocity = Chamber.CFrame.lookVector * 20 + Vector3.new(math.random(5,5),10,math.random(5,5))
Spit.RotVelocity = Vector3.new(0,200,0)
end
end)
end)